Skip to content

Unsupported type: never #620

@EladBezalel

Description

@EladBezalel

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.

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