9ebe11c2d3
* Add the types_web dom dts * Update * Adds new DTS * Update baselines
97 lines
4.9 KiB
Plaintext
97 lines
4.9 KiB
Plaintext
=== tests/cases/compiler/intersectionsOfLargeUnions2.ts ===
|
|
// Repro from #24233
|
|
|
|
declare global {
|
|
>global : any
|
|
|
|
interface ElementTagNameMap {
|
|
[index: number]: HTMLElement
|
|
>index : number
|
|
}
|
|
|
|
interface HTMLElement {
|
|
[index: number]: HTMLElement;
|
|
>index : number
|
|
}
|
|
}
|
|
|
|
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" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "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" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "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" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "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" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "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" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "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" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "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
|
|
}
|
|
}
|
|
|