diff --git a/docs/pages/cli/abi-ts.mdx b/docs/pages/cli/abi-ts.mdx index 4f6781301c..913493b436 100644 --- a/docs/pages/cli/abi-ts.mdx +++ b/docs/pages/cli/abi-ts.mdx @@ -79,7 +79,7 @@ This command converts [JSON files](https://www.json.org/json-en.html) that conta 1. See the new file. ```sh copy - less greeting.abi.json.d.ts + less greeting.abi.d.json.ts ``` ## Debugging diff --git a/packages/abi-ts/README.md b/packages/abi-ts/README.md index 6a081f1059..2ba87ff935 100644 --- a/packages/abi-ts/README.md +++ b/packages/abi-ts/README.md @@ -1,6 +1,6 @@ # abi-ts -Create TypeScript type declaration files (`.d.ts`) for your ABI JSON files. +Create TypeScript type declaration files (`.d.json.ts`) for your ABI JSON files. This allows you to import your JSON ABI and use it directly with libraries like [viem](https://npmjs.com/package/viem) and [abitype](https://npmjs.com/package/abitype). diff --git a/packages/abi-ts/src/index.ts b/packages/abi-ts/src/index.ts index 7c859443d0..98c91317d9 100644 --- a/packages/abi-ts/src/index.ts +++ b/packages/abi-ts/src/index.ts @@ -39,7 +39,7 @@ const commandModule: CommandModule = { } const ts = `declare const abi: ${json}; export default abi;\n`; - const tsFilename = `${jsonFilename}.d.ts`; + const tsFilename = jsonFilename.replace(".json", ".d.json.ts"); debug("Writing", tsFilename); writeFileSync(tsFilename, ts); diff --git a/packages/common/tsconfig.base.json b/packages/common/tsconfig.base.json index 1c1554782e..146774690a 100644 --- a/packages/common/tsconfig.base.json +++ b/packages/common/tsconfig.base.json @@ -17,6 +17,7 @@ "esModuleInterop": true, "noErrorTruncation": true, "resolveJsonModule": true, + "allowArbitraryExtensions": true, "forceConsistentCasingInFileNames": true, "sourceMap": true } diff --git a/packages/world/tsconfig.json b/packages/world/tsconfig.json index 146ec2d52b..ea73d4c40f 100644 --- a/packages/world/tsconfig.json +++ b/packages/world/tsconfig.json @@ -1,9 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - // needed to ensure tests like those in packages/world/ts/encodeSystemCall.test.ts - // resolve narrowed types from .d.ts as opposed to widened ones from abi.json - "resolveJsonModule": false, "lib": ["ESNext", "DOM"], "outDir": "dist" },