* Always generate type & symbol baselines * Accept changed shadowed baselines * Accept brand new type and symbol baselines * Allow `getTypeAtLocation` to return undefined in the type writer * Accept baselines which had missing type information * Bind container for dynamically names enum members so they may be printed * Accept type/symbol baselines for enums with computed members * First pass at reducing typeWriter memory overhead * Use generators to allow for type and symbol baselines with no cache * Accept new baselines for tests whose output was fixed by better newline splitting * Hard cap on number of declarations printed, cache declaration print text * handle differing newlines better still to handle RWC newlines * Lower abridging count, accept abridged baselines * Limit max RWC error output size, limit RWC type and symbol baseline input size * Move skip logic into type and symbol baseliner to streamline error handling * Accept removal of empty baselines * Canonicalize path earlier to handle odd paths in input files * Do canonicalization earlier still, also ensure parallel perf profiles for different targets do not trample one another * No need to pathify again
97 lines
1.7 KiB
Plaintext
97 lines
1.7 KiB
Plaintext
=== tests/cases/compiler/widenedTypes.ts ===
|
|
null instanceof (() => { });
|
|
>null instanceof (() => { }) : boolean
|
|
>null : null
|
|
>(() => { }) : () => void
|
|
>() => { } : () => void
|
|
|
|
({}) instanceof null; // Ok because null is a subtype of function
|
|
>({}) instanceof null : boolean
|
|
>({}) : {}
|
|
>{} : {}
|
|
>null : null
|
|
|
|
null in {};
|
|
>null in {} : boolean
|
|
>null : null
|
|
>{} : {}
|
|
|
|
"" in null;
|
|
>"" in null : boolean
|
|
>"" : ""
|
|
>null : null
|
|
|
|
for (var a in null) { }
|
|
>a : string
|
|
>null : null
|
|
|
|
var t = [3, (3, null)];
|
|
>t : number[]
|
|
>[3, (3, null)] : number[]
|
|
>3 : 3
|
|
>(3, null) : null
|
|
>3, null : null
|
|
>3 : 3
|
|
>null : null
|
|
|
|
t[3] = "";
|
|
>t[3] = "" : ""
|
|
>t[3] : number
|
|
>t : number[]
|
|
>3 : 3
|
|
>"" : ""
|
|
|
|
var x: typeof undefined = 3;
|
|
>x : any
|
|
>undefined : undefined
|
|
>3 : 3
|
|
|
|
x = 3;
|
|
>x = 3 : 3
|
|
>x : any
|
|
>3 : 3
|
|
|
|
var y;
|
|
>y : any
|
|
|
|
var u = [3, (y = null)];
|
|
>u : number[]
|
|
>[3, (y = null)] : number[]
|
|
>3 : 3
|
|
>(y = null) : null
|
|
>y = null : null
|
|
>y : any
|
|
>null : null
|
|
|
|
u[3] = "";
|
|
>u[3] = "" : ""
|
|
>u[3] : number
|
|
>u : number[]
|
|
>3 : 3
|
|
>"" : ""
|
|
|
|
var ob: { x: typeof undefined } = { x: "" };
|
|
>ob : { x: any; }
|
|
>x : any
|
|
>undefined : undefined
|
|
>{ x: "" } : { x: string; }
|
|
>x : string
|
|
>"" : ""
|
|
|
|
// Highlights the difference between array literals and object literals
|
|
var arr: string[] = [3, null]; // not assignable because null is not widened. BCT is {}
|
|
>arr : string[]
|
|
>[3, null] : number[]
|
|
>3 : 3
|
|
>null : null
|
|
|
|
var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any
|
|
>obj : { [x: string]: string; }
|
|
>x : string
|
|
>{ x: 3, y: null } : { x: number; y: null; }
|
|
>x : number
|
|
>3 : 3
|
|
>y : null
|
|
>null : null
|
|
|