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
|
=== tests/cases/conformance/controlFlow/controlFlowBinaryOrExpression.ts ===
let x: string | number | boolean;
>x : string | number | boolean
let cond: boolean;
>cond : boolean
(x = "") || (x = 0);
>(x = "") || (x = 0) : 0
>(x = "") : ""
>x = "" : ""
>x : string | number | boolean
>"" : ""
>(x = 0) : 0
>x = 0 : 0
>x : string | number | boolean
>0 : 0
x; // string | number
>x : string | number
x = "";
>x = "" : ""
>x : string | number | boolean
>"" : ""
cond || (x = 0);
>cond || (x = 0) : true | 0
>cond : boolean
>(x = 0) : 0
>x = 0 : 0
>x : string | number | boolean
>0 : 0
x; // string | number
>x : string | number
export interface NodeList {
length: number;
>length : number
}
export interface HTMLCollection {
length: number;
>length : number
}
declare function isNodeList(sourceObj: any): sourceObj is NodeList;
>isNodeList : (sourceObj: any) => sourceObj is NodeList
>sourceObj : any
declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection;
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection
>sourceObj : any
type EventTargetLike = {a: string} | HTMLCollection | NodeList;
>EventTargetLike : EventTargetLike
>a : string
var sourceObj: EventTargetLike = <any>undefined;
>sourceObj : EventTargetLike
><any>undefined : any
>undefined : undefined
if (isNodeList(sourceObj)) {
>isNodeList(sourceObj) : boolean
>isNodeList : (sourceObj: any) => sourceObj is NodeList
>sourceObj : EventTargetLike
sourceObj.length;
>sourceObj.length : number
>sourceObj : NodeList | HTMLCollection
>length : number
}
if (isHTMLCollection(sourceObj)) {
>isHTMLCollection(sourceObj) : boolean
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection
>sourceObj : EventTargetLike
sourceObj.length;
>sourceObj.length : number
>sourceObj : NodeList | HTMLCollection
>length : number
}
if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
>isNodeList(sourceObj) || isHTMLCollection(sourceObj) : boolean
>isNodeList(sourceObj) : boolean
>isNodeList : (sourceObj: any) => sourceObj is NodeList
>sourceObj : EventTargetLike
>isHTMLCollection(sourceObj) : boolean
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection
>sourceObj : { a: string; }
sourceObj.length;
>sourceObj.length : number
>sourceObj : NodeList
>length : number
}
|