Skip to content

Commit 36e26c1

Browse files
Accepted baselines.
1 parent bda32ae commit 36e26c1

4 files changed

+104
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts(9,5): error TS2322: Type '{ bar: { prop: number; }; }[]' is not assignable to type 'Foo[]'.
2+
Type '{ bar: { prop: number; }; }' is not assignable to type 'Foo'.
3+
Types of property 'bar' are incompatible.
4+
Type '{ prop: number; }' is not assignable to type 'Bar | Bar[]'.
5+
Type '{ prop: number; }' is not assignable to type 'Bar[]'.
6+
Property 'length' is missing in type '{ prop: number; }'.
7+
8+
9+
==== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts (1 errors) ====
10+
interface Foo {
11+
bar: Bar | Bar[];
12+
}
13+
14+
interface Bar {
15+
prop: string;
16+
}
17+
18+
let x: Foo[] = [
19+
~
20+
!!! error TS2322: Type '{ bar: { prop: number; }; }[]' is not assignable to type 'Foo[]'.
21+
!!! error TS2322: Type '{ bar: { prop: number; }; }' is not assignable to type 'Foo'.
22+
!!! error TS2322: Types of property 'bar' are incompatible.
23+
!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'Bar | Bar[]'.
24+
!!! error TS2322: Type '{ prop: number; }' is not assignable to type 'Bar[]'.
25+
!!! error TS2322: Property 'length' is missing in type '{ prop: number; }'.
26+
{ bar: { prop: 100 } }
27+
]
28+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//// [objectLiteralsAgainstUnionsOfArrays01.ts]
2+
interface Foo {
3+
bar: Bar | Bar[];
4+
}
5+
6+
interface Bar {
7+
prop: string;
8+
}
9+
10+
let x: Foo[] = [
11+
{ bar: { prop: 100 } }
12+
]
13+
14+
15+
//// [objectLiteralsAgainstUnionsOfArrays01.js]
16+
var x = [
17+
{ bar: { prop: 100 } }
18+
];
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
=== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts ===
2+
interface Foo {
3+
>Foo : Symbol(Foo, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 0))
4+
5+
bar: Bar | Bar[];
6+
>bar : Symbol(Foo.bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 15))
7+
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
8+
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
9+
}
10+
11+
interface Bar {
12+
>Bar : Symbol(Bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 2, 1))
13+
14+
prop: string;
15+
>prop : Symbol(Bar.prop, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 4, 15))
16+
}
17+
18+
let x: Foo[] = [
19+
>x : Symbol(x, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 8, 3))
20+
>Foo : Symbol(Foo, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 0, 0))
21+
22+
{ bar: { prop: 100 } }
23+
>bar : Symbol(bar, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 9, 3))
24+
>prop : Symbol(prop, Decl(objectLiteralsAgainstUnionsOfArrays01.ts, 9, 10))
25+
26+
]
27+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
=== tests/cases/compiler/objectLiteralsAgainstUnionsOfArrays01.ts ===
2+
interface Foo {
3+
>Foo : Foo
4+
5+
bar: Bar | Bar[];
6+
>bar : Bar | Bar[]
7+
>Bar : Bar
8+
>Bar : Bar
9+
}
10+
11+
interface Bar {
12+
>Bar : Bar
13+
14+
prop: string;
15+
>prop : string
16+
}
17+
18+
let x: Foo[] = [
19+
>x : Foo[]
20+
>Foo : Foo
21+
>[ { bar: { prop: 100 } }] : { bar: { prop: number; }; }[]
22+
23+
{ bar: { prop: 100 } }
24+
>{ bar: { prop: 100 } } : { bar: { prop: number; }; }
25+
>bar : { prop: number; }
26+
>{ prop: 100 } : { prop: number; }
27+
>prop : number
28+
>100 : 100
29+
30+
]
31+

0 commit comments

Comments
 (0)