CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.8.13 (changelog, source)

Member predicate Type::unfold

Repeatedly unfolds unions, intersections, and type aliases and gets any of the underlying types, or this type itself if it is not a union or intersection.

For example, the type (S & T) | U unfolds to S, T, and U.

If this is a type alias, the alias is itself included in the result, but this is not the case for intermediate type aliases. For example:

type One = number | string;
type Two = One | Function & {x: string};
One; // unfolds to number, string, and One
Two; // unfolds to number, string, One, Function, {x: string}, and Two
Type unfold()