Skip to content

Incompatibility with TypeScript's erasableSyntaxOnly option #116

@RDO34

Description

@RDO34

Hi, thanks for all the work that's been done on this project!

I'm currently trying to use this package in a new project that runs TypeScript code natively via Node's new type-stripping features and that uses TypeScript's erasableSyntaxOnly option to ensure no non-erasable features are used.

This seems to break when using this package however, as TypeScript will resolve to the un-compiled .ts files and complain about the enums.

This applies when:

  • Node > V22.6.0 & < v23.6.0 and the --experimental-strip-types flag is used to run TypeScript code natively.
  • Node > v23.6.0 and is used to run TypeScript code natively.

And:

  • TypeScript is used as a type-checking tool, with it's erasableSyntaxOnly option used to enforce erasable type annotations.

I've set up a very minimal reproduction here: https://github.com/RDO34/minimal-json-schema-typed-reproduction

I believe that one solution would be to emit .d.ts declaration files during the build, and to update the /dist package.json exports to direct the TypeScript compiler to these declaration files.

Is there any scope to make this change?

If you're accepting contributions, I'd be happy to open a PR!

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions