You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[API] Expose some type checker features that were available in TS6 #64533
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.
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<{}>>.
Activity
LukasTy commentedon Nov 26, 2026
Another use case for
UnionType.getOrigin(): our docs extractor readsoriginin 6.0 to keep alias names in unions (source).With
type Size = 'small' | 'medium' | 'large'andorNull: Size | null, the 7.1 API givesgetTypes()=null, "large", "medium", "small". OnlyorigingivesSize, null.typeToStringin 7.1 still printsSize | 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<{}>>becomesReact.ComponentClass<ComponentType<{}>, any> | React.FunctionComponent<ComponentType<{}>>.The
getOrigin()shape in #64535 covers our use.