Test:Unknown properties are assignable to Object in union

Add test and accept baselines
This commit is contained in:
Nathan Shively-Sanders
2017-04-18 14:58:27 -07:00
parent adefdc7953
commit 8ab22217c1
4 changed files with 37 additions and 0 deletions
@@ -0,0 +1,8 @@
//// [unknownPropertiesAreAssignableToObjectUnion.ts]
const x: Object | string = { x: 0 };
const y: Object | undefined = { x: 0 };
//// [unknownPropertiesAreAssignableToObjectUnion.js]
var x = { x: 0 };
var y = { x: 0 };
@@ -0,0 +1,11 @@
=== tests/cases/compiler/unknownPropertiesAreAssignableToObjectUnion.ts ===
const x: Object | string = { x: 0 };
>x : Symbol(x, Decl(unknownPropertiesAreAssignableToObjectUnion.ts, 0, 5))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(unknownPropertiesAreAssignableToObjectUnion.ts, 0, 28))
const y: Object | undefined = { x: 0 };
>y : Symbol(y, Decl(unknownPropertiesAreAssignableToObjectUnion.ts, 1, 5))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>x : Symbol(x, Decl(unknownPropertiesAreAssignableToObjectUnion.ts, 1, 31))
@@ -0,0 +1,15 @@
=== tests/cases/compiler/unknownPropertiesAreAssignableToObjectUnion.ts ===
const x: Object | string = { x: 0 };
>x : string | Object
>Object : Object
>{ x: 0 } : { x: number; }
>x : number
>0 : 0
const y: Object | undefined = { x: 0 };
>y : Object | undefined
>Object : Object
>{ x: 0 } : { x: number; }
>x : number
>0 : 0
@@ -0,0 +1,3 @@
// @strictNullChecks: true
const x: Object | string = { x: 0 };
const y: Object | undefined = { x: 0 };