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
|
=== tests/cases/conformance/types/typeRelationships/widenedTypes/objectLiteralWidened.ts ===
// object literal properties are widened to any
var x1 = {
>x1 : Symbol(x1, Decl(objectLiteralWidened.ts, 2, 3))
foo: null,
>foo : Symbol(foo, Decl(objectLiteralWidened.ts, 2, 10))
bar: undefined
>bar : Symbol(bar, Decl(objectLiteralWidened.ts, 3, 14))
>undefined : Symbol(undefined)
}
var y1 = {
>y1 : Symbol(y1, Decl(objectLiteralWidened.ts, 7, 3))
foo: null,
>foo : Symbol(foo, Decl(objectLiteralWidened.ts, 7, 10))
bar: {
>bar : Symbol(bar, Decl(objectLiteralWidened.ts, 8, 14))
baz: null,
>baz : Symbol(baz, Decl(objectLiteralWidened.ts, 9, 10))
boo: undefined
>boo : Symbol(boo, Decl(objectLiteralWidened.ts, 10, 18))
>undefined : Symbol(undefined)
}
}
// these are not widened
var u: undefined = undefined;
>u : Symbol(u, Decl(objectLiteralWidened.ts, 17, 3))
>undefined : Symbol(undefined)
var n: null = null;
>n : Symbol(n, Decl(objectLiteralWidened.ts, 18, 3))
var x2 = {
>x2 : Symbol(x2, Decl(objectLiteralWidened.ts, 20, 3))
foo: n,
>foo : Symbol(foo, Decl(objectLiteralWidened.ts, 20, 10))
>n : Symbol(n, Decl(objectLiteralWidened.ts, 18, 3))
bar: u
>bar : Symbol(bar, Decl(objectLiteralWidened.ts, 21, 11))
>u : Symbol(u, Decl(objectLiteralWidened.ts, 17, 3))
}
var y2 = {
>y2 : Symbol(y2, Decl(objectLiteralWidened.ts, 25, 3))
foo: n,
>foo : Symbol(foo, Decl(objectLiteralWidened.ts, 25, 10))
>n : Symbol(n, Decl(objectLiteralWidened.ts, 18, 3))
bar: {
>bar : Symbol(bar, Decl(objectLiteralWidened.ts, 26, 11))
baz: n,
>baz : Symbol(baz, Decl(objectLiteralWidened.ts, 27, 10))
>n : Symbol(n, Decl(objectLiteralWidened.ts, 18, 3))
boo: u
>boo : Symbol(boo, Decl(objectLiteralWidened.ts, 28, 15))
>u : Symbol(u, Decl(objectLiteralWidened.ts, 17, 3))
}
}
|