Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2018-07-17 21:52:36 -07:00
parent bda32aeee2
commit 36e26c1a35
4 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,28 @@
tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts(9,5): error TS2322: Type '{ bar: { prop: number; }; }[]' is not assignable to type 'Foo[]'.
Type '{ bar: { prop: number; }; }' is not assignable to type 'Foo'.
Types of property 'bar' are incompatible.
Type '{ prop: number; }' is not assignable to type 'Bar | Bar[]'.
Type '{ prop: number; }' is not assignable to type 'Bar[]'.
Property 'length' is missing in type '{ prop: number; }'.
==== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts (1 errors) ====
interface Foo {
bar: Bar | Bar[];
}
interface Bar {
prop: string;
}
let x: Foo[] = [
~
!!! error TS2322: Type '{ bar: { prop: number; }; }[]' is not assignable to type 'Foo[]'.
!!! error TS2322: Type '{ bar: { prop: number; }; }' is not assignable to type 'Foo'.
!!! error TS2322: Types of property 'bar' are incompatible.
!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'Bar | Bar[]'.
!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'Bar[]'.
!!! error TS2322: Property 'length' is missing in type '{ prop: number; }'.
{ bar: { prop: 100 } }
]

View File

@ -0,0 +1,18 @@
//// [objectLiteralsAgainstUnionsOfArrays01.ts]
interface Foo {
bar: Bar | Bar[];
}
interface Bar {
prop: string;
}
let x: Foo[] = [
{ bar: { prop: 100 } }
]
//// [objectLiteralsAgainstUnionsOfArrays01.js]
var x = [
{ bar: { prop: 100 } }
];

View File

@ -0,0 +1,27 @@
=== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 0))
bar: Bar | Bar[];
>bar : Symbol(Foo.bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 15))
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
}
interface Bar {
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
prop: string;
>prop : Symbol(Bar.prop, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 4, 15))
}
let x: Foo[] = [
>x : Symbol(x, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 8, 3))
>Foo : Symbol(Foo, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 0))
{ bar: { prop: 100 } }
>bar : Symbol(bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 9, 3))
>prop : Symbol(prop, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 9, 10))
]

View File

@ -0,0 +1,31 @@
=== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts ===
interface Foo {
>Foo : Foo
bar: Bar | Bar[];
>bar : Bar | Bar[]
>Bar : Bar
>Bar : Bar
}
interface Bar {
>Bar : Bar
prop: string;
>prop : string
}
let x: Foo[] = [
>x : Foo[]
>Foo : Foo
>[ { bar: { prop: 100 } }] : { bar: { prop: number; }; }[]
{ bar: { prop: 100 } }
>{ bar: { prop: 100 } } : { bar: { prop: number; }; }
>bar : { prop: number; }
>{ prop: 100 } : { prop: number; }
>prop : number
>100 : 100
]