paritytech / capi

[WIP] A framework for crafting interactions with Substrate chains
https://docs.capi.dev
Apache License 2.0
104 stars 9 forks source link

typescript diagonostic codes not properly thrown during `capi sync` #1180

Open ryanleecode opened 1 year ago

ryanleecode commented 1 year ago

I was running capi sync in a react-native project and it failed with

➜  capi-react-native-example git:(feat/rollup) ✗ npm run sync

> capi-react-native-example@1.0.0 sync
> capi sync node

(node:17091) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
file:///home/ryan/Documents/Repositories/capi-vite-example/capi-react-native-example/node_modules/capi/esm/deps_2/deno.land/x/cliffy@v0.25.7/command/command.js:908
                : new Error(`[non-error-thrown] ${error}`));
                  ^

Error: [non-error-thrown] [object Object]
    at Command.handleError (file:///home/ryan/Documents/Repositories/capi-vite-example/capi-react-native-example/node_modules/capi/esm/deps_2/deno.land/x/cliffy@v0.25.7/command/command.js:908:19)
    at Command.parseCommand (file:///home/ryan/Documents/Repositories/capi-vite-example/capi-react-native-example/node_modules/capi/esm/deps_2/deno.land/x/cliffy@v0.25.7/command/command.js:595:18)

Node.js v20.3.1

throwing a non-error. editing the transpiled javascript to print out what the actual error was produced:

{ diagnosticCodes: [ 2307 ] }

Which seems to be TS2307 - cannot find module for local file.


Could be a cliffy issue and not a capi issue since theres no stacktrace relating to capi, only cliffy.

ryanleecode commented 1 year ago

Adding this to tsconfig fixes it

  "module": "ESNext",
  "moduleResolution": "node16"