97 lines
7.8 KiB
Plaintext
97 lines
7.8 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" | "object" | "a" | "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" | "script" | "stop" | "style" | "svg" | "switch" | "text" | "textPath" | "title" | "tspan" | "use" | "view" | "abbr" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr", 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" | "object" | "a" | "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" | "script" | "stop" | "style" | "svg" | "switch" | "text" | "textPath" | "title" | "tspan" | "use" | "view" | "abbr" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr", 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" | "object" | "a" | "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" | "script" | "stop" | "style" | "svg" | "switch" | "text" | "textPath" | "title" | "tspan" | "use" | "view" | "abbr" | "address" | "applet" | "area" | "article" | "aside" | "audio" | "b" | "base" | "basefont" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "dir" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "font" | "footer" | "form" | "frame" | "frameset" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "marquee" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr", 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
|
|
}
|
|
}
|
|
|