You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.errors.txt
+19-6Lines changed: 19 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,19 @@
1
1
contextualTypeWithUnionTypeObjectLiteral.ts(14,5): error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
2
-
Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
2
+
Type '{ prop: string | number; }' is not assignable to type '{ prop: string; }'.
3
+
Types of property 'prop' are incompatible.
4
+
Type 'string | number' is not assignable to type 'string'.
5
+
Type 'number' is not assignable to type 'string'.
3
6
contextualTypeWithUnionTypeObjectLiteral.ts(20,5): error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
4
-
Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
7
+
Property 'anotherP' is missing in type '{ prop: string | number; }' but required in type '{ prop: string; anotherP: string; }'.
5
8
contextualTypeWithUnionTypeObjectLiteral.ts(22,5): error TS2322: Type 'string | number' is not assignable to type 'string'.
6
9
Type 'number' is not assignable to type 'string'.
7
10
contextualTypeWithUnionTypeObjectLiteral.ts(26,5): error TS2322: Type 'string | number' is not assignable to type 'string'.
8
11
Type 'number' is not assignable to type 'string'.
9
12
contextualTypeWithUnionTypeObjectLiteral.ts(29,5): error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
10
-
Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
13
+
Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; }'.
14
+
Types of property 'prop' are incompatible.
15
+
Type 'string | number' is not assignable to type 'string'.
16
+
Type 'number' is not assignable to type 'string'.
11
17
contextualTypeWithUnionTypeObjectLiteral.ts(58,5): error TS2322: Type '(a: string, b: number) => string | number' is not assignable to type '((a: string, b: number) => string) | ((a: string, b: number) => number)'.
12
18
Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => string'.
13
19
Type 'string | number' is not assignable to type 'string'.
@@ -31,7 +37,10 @@ contextualTypeWithUnionTypeObjectLiteral.ts(58,5): error TS2322: Type '(a: strin
31
37
var objStrOrNum3: { prop: string } | { prop: number } = {
32
38
~~~~~~~~~~~~
33
39
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
34
-
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
40
+
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; }'.
41
+
!!! error TS2322: Types of property 'prop' are incompatible.
42
+
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
43
+
!!! error TS2322: Type 'number' is not assignable to type 'string'.
35
44
prop: strOrNumber
36
45
};
37
46
var objStrOrNum4: { prop: string | number } = {
@@ -40,7 +49,8 @@ contextualTypeWithUnionTypeObjectLiteral.ts(58,5): error TS2322: Type '(a: strin
40
49
var objStrOrNum5: { prop: string; anotherP: string; } | { prop: number } = { prop: strOrNumber };
41
50
~~~~~~~~~~~~
42
51
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
43
-
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
52
+
!!! error TS2322: Property 'anotherP' is missing in type '{ prop: string | number; }' but required in type '{ prop: string; anotherP: string; }'.
53
+
!!! related TS2728 contextualTypeWithUnionTypeObjectLiteral.ts:20:35: 'anotherP' is declared here.
44
54
var objStrOrNum6: { prop: string; anotherP: string; } | { prop: number } = {
45
55
prop: strOrNumber,
46
56
~~~~
@@ -60,7 +70,10 @@ contextualTypeWithUnionTypeObjectLiteral.ts(58,5): error TS2322: Type '(a: strin
60
70
var objStrOrNum8: { prop: string; anotherP: string; } | { prop: number; anotherP1: number } = {
61
71
~~~~~~~~~~~~
62
72
!!! error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
63
-
!!! error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
73
+
!!! error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; }'.
74
+
!!! error TS2322: Types of property 'prop' are incompatible.
75
+
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
76
+
!!! error TS2322: Type 'number' is not assignable to type 'string'.
Copy file name to clipboardExpand all lines: tests/baselines/reference/excessPropertyCheckWithUnions.errors.txt
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ excessPropertyCheckWithUnions.ts(33,28): error TS2353: Object literal may only s
6
6
excessPropertyCheckWithUnions.ts(34,26): error TS2353: Object literal may only specify known properties, and 'extra' does not exist in type '{ tag: "A"; x: string; } | { tag: "A"; y: number; }'.
7
7
excessPropertyCheckWithUnions.ts(37,1): error TS2322: Type '{ tag: "A"; }' is not assignable to type 'Ambiguous'.
8
8
Type '{ tag: "A"; }' is not assignable to type '{ tag: "A"; x: string; } | { tag: "A"; y: number; }'.
9
+
Property 'x' is missing in type '{ tag: "A"; }' but required in type '{ tag: "A"; x: string; }'.
9
10
excessPropertyCheckWithUnions.ts(38,19): error TS2353: Object literal may only specify known properties, and 'z' does not exist in type '{ tag: "A"; x: string; } | { tag: "A"; y: number; }'.
10
11
excessPropertyCheckWithUnions.ts(47,35): error TS2353: Object literal may only specify known properties, and 'second' does not exist in type '{ a: 1; b: 1; first: string; }'.
11
12
excessPropertyCheckWithUnions.ts(48,35): error TS2353: Object literal may only specify known properties, and 'third' does not exist in type '{ a: 1; b: 1; first: string; }'.
@@ -69,6 +70,8 @@ excessPropertyCheckWithUnions.ts(112,63): error TS2322: Type 'string' is not ass
69
70
~~~
70
71
!!! error TS2322: Type '{ tag: "A"; }' is not assignable to type 'Ambiguous'.
71
72
!!! error TS2322: Type '{ tag: "A"; }' is not assignable to type '{ tag: "A"; x: string; } | { tag: "A"; y: number; }'.
73
+
!!! error TS2322: Property 'x' is missing in type '{ tag: "A"; }' but required in type '{ tag: "A"; x: string; }'.
74
+
!!! related TS2728 excessPropertyCheckWithUnions.ts:16:5: 'x' is declared here.
72
75
amb = { tag: "A", z: true }
73
76
~
74
77
!!! error TS2353: Object literal may only specify known properties, and 'z' does not exist in type '{ tag: "A"; x: string; } | { tag: "A"; y: number; }'.
Copy file name to clipboardExpand all lines: tests/baselines/reference/genericRestParameters3.errors.txt
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@ genericRestParameters3.ts(17,11): error TS2345: Argument of type '[10]' is not a
2
2
Type '[10]' is not assignable to type '[string]'.
3
3
Type 'number' is not assignable to type 'string'.
4
4
genericRestParameters3.ts(18,1): error TS2345: Argument of type '[]' is not assignable to parameter of type '[string] | [number, boolean]'.
5
+
Type '[]' is not assignable to type '[string]'.
6
+
Source has 0 element(s) but target requires 1.
5
7
genericRestParameters3.ts(23,1): error TS2322: Type '(x: string, y: string) => void' is not assignable to type '(x: string, ...args: [string] | [number, boolean]) => void'.
6
8
Types of parameters 'y' and 'args' are incompatible.
7
9
Type '[string] | [number, boolean]' is not assignable to type '[y: string]'.
@@ -57,6 +59,8 @@ genericRestParameters3.ts(59,5): error TS2345: Argument of type '["what"]' is no
57
59
f1("foo"); // Error
58
60
~~~~~~~~~
59
61
!!! error TS2345: Argument of type '[]' is not assignable to parameter of type '[string] | [number, boolean]'.
62
+
!!! error TS2345: Type '[]' is not assignable to type '[string]'.
63
+
!!! error TS2345: Source has 0 element(s) but target requires 1.
0 commit comments