Skip to content

Commit

Permalink
fix(abi-ts): ts output should use as const (#3348)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Oct 30, 2024
1 parent cd9fd0a commit 5340394
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/smart-suns-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/abi-ts": patch
---

Using a TS extension (rather than DTS) now correctly includes `as const` in the TS output.
2 changes: 1 addition & 1 deletion packages/abi-ts/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const command: CommandModule<Options, Options> = {

const ts = tsExtension.includes(".d.")
? `declare const abi: ${json};\n\nexport default abi;\n`
: `const abi = ${json};\n\nexport default abi;\n`;
: `const abi = ${json} as const;\n\nexport default abi;\n`;

debug("Writing", tsFilename);
writeFileSync(tsFilename, ts);
Expand Down

0 comments on commit 5340394

Please sign in to comment.