1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
=== tests/cases/compiler/intersectionsOfLargeUnions2.ts ===
// Repro from #24233
declare global {
>global : Symbol(global, Decl(intersectionsOfLargeUnions2.ts, 0, 0))
interface ElementTagNameMap {
>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.dom.d.ts, --, --), Decl(intersectionsOfLargeUnions2.ts, 2, 16))
[index: number]: HTMLElement
>index : Symbol(index, Decl(intersectionsOfLargeUnions2.ts, 4, 9))
>HTMLElement : Symbol(HTMLElement, Decl(intersectionsOfLargeUnions2.ts, 5, 5))
}
interface HTMLElement {
>HTMLElement : Symbol(HTMLElement, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(intersectionsOfLargeUnions2.ts, 5, 5))
[index: number]: HTMLElement;
>index : Symbol(index, Decl(intersectionsOfLargeUnions2.ts, 8, 9))
>HTMLElement : Symbol(HTMLElement, Decl(intersectionsOfLargeUnions2.ts, 5, 5))
}
}
export function assertIsElement(node: Node | null): node is Element {
>assertIsElement : Symbol(assertIsElement, Decl(intersectionsOfLargeUnions2.ts, 10, 1))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 12, 32))
>Node : Symbol(Node, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 12, 32))
>Element : Symbol(Element, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
let nodeType = node === null ? null : node.nodeType;
>nodeType : Symbol(nodeType, Decl(intersectionsOfLargeUnions2.ts, 13, 7))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 12, 32))
>node.nodeType : Symbol(Node.nodeType, Decl(lib.dom.d.ts, --, --))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 12, 32))
>nodeType : Symbol(Node.nodeType, Decl(lib.dom.d.ts, --, --))
return nodeType === 1;
>nodeType : Symbol(nodeType, Decl(intersectionsOfLargeUnions2.ts, 13, 7))
}
export function assertNodeTagName<
>assertNodeTagName : Symbol(assertNodeTagName, Decl(intersectionsOfLargeUnions2.ts, 15, 1))
T extends keyof ElementTagNameMap,
>T : Symbol(T, Decl(intersectionsOfLargeUnions2.ts, 17, 34))
>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.dom.d.ts, --, --), Decl(intersectionsOfLargeUnions2.ts, 2, 16))
U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U {
>U : Symbol(U, Decl(intersectionsOfLargeUnions2.ts, 18, 38))
>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.dom.d.ts, --, --), Decl(intersectionsOfLargeUnions2.ts, 2, 16))
>T : Symbol(T, Decl(intersectionsOfLargeUnions2.ts, 17, 34))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 19, 36))
>Node : Symbol(Node, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions2.ts, 19, 54))
>T : Symbol(T, Decl(intersectionsOfLargeUnions2.ts, 17, 34))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 19, 36))
>U : Symbol(U, Decl(intersectionsOfLargeUnions2.ts, 18, 38))
if (assertIsElement(node)) {
>assertIsElement : Symbol(assertIsElement, Decl(intersectionsOfLargeUnions2.ts, 10, 1))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 19, 36))
const nodeTagName = node.tagName.toLowerCase();
>nodeTagName : Symbol(nodeTagName, Decl(intersectionsOfLargeUnions2.ts, 21, 13))
>node.tagName.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
>node.tagName : Symbol(Element.tagName, Decl(lib.dom.d.ts, --, --))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 19, 36))
>tagName : Symbol(Element.tagName, Decl(lib.dom.d.ts, --, --))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
return nodeTagName === tagName;
>nodeTagName : Symbol(nodeTagName, Decl(intersectionsOfLargeUnions2.ts, 21, 13))
>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions2.ts, 19, 54))
}
return false;
}
export function assertNodeProperty<
>assertNodeProperty : Symbol(assertNodeProperty, Decl(intersectionsOfLargeUnions2.ts, 25, 1))
T extends keyof ElementTagNameMap,
>T : Symbol(T, Decl(intersectionsOfLargeUnions2.ts, 27, 35))
>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.dom.d.ts, --, --), Decl(intersectionsOfLargeUnions2.ts, 2, 16))
P extends keyof ElementTagNameMap[T],
>P : Symbol(P, Decl(intersectionsOfLargeUnions2.ts, 28, 38))
>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.dom.d.ts, --, --), Decl(intersectionsOfLargeUnions2.ts, 2, 16))
>T : Symbol(T, Decl(intersectionsOfLargeUnions2.ts, 27, 35))
V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) {
>V : Symbol(V, Decl(intersectionsOfLargeUnions2.ts, 29, 41))
>HTMLElementTagNameMap : Symbol(HTMLElementTagNameMap, Decl(lib.dom.d.ts, --, --))
>T : Symbol(T, Decl(intersectionsOfLargeUnions2.ts, 27, 35))
>P : Symbol(P, Decl(intersectionsOfLargeUnions2.ts, 28, 38))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 30, 43))
>Node : Symbol(Node, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions2.ts, 30, 61))
>T : Symbol(T, Decl(intersectionsOfLargeUnions2.ts, 27, 35))
>prop : Symbol(prop, Decl(intersectionsOfLargeUnions2.ts, 30, 73))
>P : Symbol(P, Decl(intersectionsOfLargeUnions2.ts, 28, 38))
>value : Symbol(value, Decl(intersectionsOfLargeUnions2.ts, 30, 82))
>V : Symbol(V, Decl(intersectionsOfLargeUnions2.ts, 29, 41))
if (assertNodeTagName(node, tagName)) {
>assertNodeTagName : Symbol(assertNodeTagName, Decl(intersectionsOfLargeUnions2.ts, 15, 1))
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 30, 43))
>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions2.ts, 30, 61))
node[prop];
>node : Symbol(node, Decl(intersectionsOfLargeUnions2.ts, 30, 43))
>prop : Symbol(prop, Decl(intersectionsOfLargeUnions2.ts, 30, 73))
}
}
|