Skip to content

Commit

Permalink
fix: adding declare to structs
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Aug 5, 2024
1 parent 09e810f commit cb8daa2
Show file tree
Hide file tree
Showing 10 changed files with 1,450 additions and 1,450 deletions.
6 changes: 3 additions & 3 deletions src/commands/contract/structs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export function generateField(
decoratorArguments
)
),
ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword),
]

const typeReferenceNode = ts.factory.createTypeReferenceNode(
Expand All @@ -231,9 +232,7 @@ export function generateField(
return ts.factory.createPropertyDeclaration(
decorators,
ts.factory.createIdentifier(fieldName),
ts.factory.createToken(
field.optional ? ts.SyntaxKind.QuestionToken : ts.SyntaxKind.ExclamationToken
),
field.optional ? ts.factory.createToken(ts.SyntaxKind.QuestionToken) : undefined,
typeNode,
undefined // initializer
)
Expand Down Expand Up @@ -330,6 +329,7 @@ function findVariantStructType(
return ts.factory.createIdentifier(variantTypeString)
}
}

function findFieldStructType(
typeString: string,
namespace: string | undefined,
Expand Down
Loading

0 comments on commit cb8daa2

Please sign in to comment.