statelyai / xstate-tools

Public monorepo for XState tooling
183 stars 36 forks source link

Add .js extension to import statement for node16 #352

Open dylanarmstrong opened 1 year ago

dylanarmstrong commented 1 year ago

For node16 / nodenext support, this should append .js to the import statement.

So:

  tsTypes: {} as import("./index.typegen").Typegen0,

should become:

  tsTypes: {} as import("./index.typegen.js").Typegen0,

I believe this would be backwards compatible on non-node16 as well, so should be safe to change.

Andarist commented 1 year ago

useDeclarationFileForTypegenData exists for that reason: https://github.com/statelyai/xstate-tools/releases/tag/stately-vscode%401.14.0

dylanarmstrong commented 1 year ago

That appears to only be available in the vscode extension and not the CLI unfortunately.

Edit: Put in a PR that adds this to CLI.