Skip to content

[API] Expose some type checker features that were available in TS6 #64533

Open

Description

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

Add 4 checker features that were available in TS6 and that we are using for out docs system:

  • UnionType.getOrigin() — returns the pre-normalization union (e.g. recovers named unions collapsed during flattening) - This was marked as internal in 6.0, but it is useful for the doc system to know where the type is coming from.
  • Checker.symbolToString(symbol, enclosingDeclaration?, meaning?, flags?) — exposes checker's symbol formatting; adds SymbolFormatFlags enum.
  • UniqueESSymbolType.escapedName + Type.isUniqueESSymbolType() — exposes escaped name for unique symbol types.
  • ConditionalType.getInferTypeParameters() — exposes type parameters bound by a conditional type's infer clause.

Activity

  1. LukasTy commented on Nov 26, 2026

    @LukasTy

    Another use case for UnionType.getOrigin(): our docs extractor reads origin in 6.0 to keep alias names in unions (source).

    With type Size = 'small' | 'medium' | 'large' and orNull: Size | null, the 7.1 API gives getTypes() = null, "large", "medium", "small". Only origin gives Size, null. typeToString in 7.1 still prints Size | null, so the server has the data.

    Without origin, 13 of the 61 API reference pages that we generate change. Alias names are lost, and some output is wrong. For example, React.ComponentType<ContentFrameProps<{}>> becomes React.ComponentClass<ComponentType<{}>, any> | React.FunctionComponent<ComponentType<{}>>.

    The getOrigin() shape in #64535 covers our use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions