Skip to content

Commit

Permalink
chore: fix ts issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Jan 23, 2024
1 parent eb1e14b commit 6add110
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/@cdktf/hcl2cdk/lib/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const valueToTs = async (
}

// For iterators and dynamic blocks we put the correct TS expression in the config ahead of time
if (t.isExpression(item)) {
if (t.isNode(item) && t.isExpression(item)) {
return item;
}

Expand Down Expand Up @@ -198,7 +198,7 @@ export const valueToTs = async (
const shouldBeArray =
typeof value === "object" &&
!Array.isArray(value) &&
!t.isExpression(value) &&
!(t.isNode(value) && t.isExpression(value)) &&
!isSingleItemBlock &&
// Map type attributes must not be wrapped in arrays
!isMapAttribute(itemAttributeType) &&
Expand Down
3 changes: 2 additions & 1 deletion packages/@cdktf/hcl2cdk/lib/partialCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export function fillWithConfigAccessors(
const value = mutated[key];
const isNotDirectlyAccessible = value === undefined;
const isReplacedByAst =
t.isExpression(mutated) || t.isExpression(value as any);
(t.isNode(mutated) && t.isExpression(mutated)) ||
t.isExpression(value as any);
const isEmptyArray = Array.isArray(value) && value.length === 0;

// If this was already replaced by an AST node, we don't need to do anything
Expand Down

0 comments on commit 6add110

Please sign in to comment.