Skip to content

Unsupported type: never #620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
EladBezalel opened this issue May 19, 2025 · 0 comments
Open

Unsupported type: never #620

EladBezalel opened this issue May 19, 2025 · 0 comments

Comments

@EladBezalel
Copy link

Describe the bug
When running typescript-json-schema on a TypeScript type alias that is set to never, the tool throws an error:

TypeError: Unsupported type: never
    at JsonSchemaGenerator.getDefinitionForRootType ...

To Reproduce
Steps to reproduce the behavior:

  1. Create a file with the following content:
    export type Test = never;
  2. Run:
    npx typescript-json-schema file.ts Test
    

Expected behavior
The tool should either:

  • Generate a valid JSON schema for the never type (e.g., a schema that matches no values), or
  • Gracefully report that never is not supported, without throwing an unhandled exception.
  • When --ignoreErrors is passed, the tool should not crash and should continue processing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant