TypeScript/tests/baselines/reference/intersectionsOfLargeUnions.types
Anders Hejlsberg 6aeb8c12cc
Preserve type aliases for union and intersection types (#42149)
* Create separate types for equivalent aliased unions

* Accept new baselines

* Preserve original types for union types

* Accept new baselines

* Preserve intersection origin for union types

* Accept new baselines

* Accept new baselines

* Preserve aliases during relationship checks

* Accept new baselines

* Preserve aliases for intersection and indexed access types

* Accept new baselines

* Compute intersection-of-unions cross product without recursion

* Accept new baselines

* Use denormalized type objects for origin / support 'keyof' origins

* Accept new baselines

* Fix fourslash test

* Recursively extract named union types

* Accept new baselines

* Map on union origin in mapType to better preserve aliases and origins

* Remove redundant call

* Accept new baselines

* Revert back to declared type when branches produce equivalent union

* Accept new baselines

* Don't include denormal origin types in regular type statistics

* Fix issue with unions not being marked primitive-only

* Allow new alias to be associated with type alias instantiation

* Accept new baselines

* Revert "Accept new baselines"

This reverts commit 4507270cc1.

* Revert "Allow new alias to be associated with type alias instantiation"

This reverts commit 2c2d06dfe1.
2021-01-08 15:19:58 -10:00

83 lines
4.4 KiB
Plaintext

=== tests/cases/compiler/intersectionsOfLargeUnions.ts ===
// Repro from #23977
export function assertIsElement(node: Node | null): node is Element {
>assertIsElement : (node: Node | null) => node is Element
>node : Node | null
>null : null
let nodeType = node === null ? null : node.nodeType;
>nodeType : number | null
>node === null ? null : node.nodeType : number | null
>node === null : boolean
>node : Node | null
>null : null
>null : null
>node.nodeType : number
>node : Node
>nodeType : number
return nodeType === 1;
>nodeType === 1 : boolean
>nodeType : number | null
>1 : 1
}
export function assertNodeTagName<
>assertNodeTagName : <T extends "symbol" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap, U extends ElementTagNameMap[T]>(node: Node | null, tagName: T) => node is U
T extends keyof ElementTagNameMap,
U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U {
>node : Node | null
>null : null
>tagName : T
if (assertIsElement(node)) {
>assertIsElement(node) : boolean
>assertIsElement : (node: Node | null) => node is Element
>node : Node | null
const nodeTagName = node.tagName.toLowerCase();
>nodeTagName : string
>node.tagName.toLowerCase() : string
>node.tagName.toLowerCase : () => string
>node.tagName : string
>node : Element
>tagName : string
>toLowerCase : () => string
return nodeTagName === tagName;
>nodeTagName === tagName : boolean
>nodeTagName : string
>tagName : T
}
return false;
>false : false
}
export function assertNodeProperty<
>assertNodeProperty : <T extends "symbol" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap, P extends keyof ElementTagNameMap[T], V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) => void
T extends keyof ElementTagNameMap,
P extends keyof ElementTagNameMap[T],
V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) {
>node : Node | null
>null : null
>tagName : T
>prop : P
>value : V
if (assertNodeTagName(node, tagName)) {
>assertNodeTagName(node, tagName) : boolean
>assertNodeTagName : <T extends "symbol" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap, U extends ElementTagNameMap[T]>(node: Node | null, tagName: T) => node is U
>node : Node | null
>tagName : T
node[prop];
>node[prop] : ElementTagNameMap[T][P]
>node : ElementTagNameMap[T]
>prop : P
}
}