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
+37-37Lines changed: 37 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,29 @@
1
-
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(14,5): error TS2323: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
1
+
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(14,5): error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
2
2
Type '{ prop: string | number; }' is not assignable to type '{ prop: number; }'.
3
3
Types of property 'prop' are incompatible.
4
4
Type 'string | number' is not assignable to type 'number'.
5
5
Type 'string' is not assignable to type 'number'.
6
-
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(20,5): error TS2323: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
6
+
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(20,5): error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
7
7
Type '{ prop: string | number; }' is not assignable to type '{ prop: number; }'.
8
8
Types of property 'prop' are incompatible.
9
9
Type 'string | number' is not assignable to type 'number'.
10
10
Type 'string' is not assignable to type 'number'.
11
-
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(21,5): error TS2323: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
11
+
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(21,5): error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
12
12
Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; }'.
13
13
Types of property 'prop' are incompatible.
14
14
Type 'string | number' is not assignable to type 'number'.
15
15
Type 'string' is not assignable to type 'number'.
16
-
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(25,5): error TS2323: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
16
+
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(25,5): error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
17
17
Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
18
18
Types of property 'prop' are incompatible.
19
19
Type 'string | number' is not assignable to type 'number'.
20
20
Type 'string' is not assignable to type 'number'.
21
-
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(29,5): error TS2323: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
21
+
tests/cases/conformance/types/union/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; }'.
22
22
Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
23
23
Types of property 'prop' are incompatible.
24
24
Type 'string | number' is not assignable to type 'number'.
25
25
Type 'string' is not assignable to type 'number'.
26
-
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(57,5): error TS2323: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I11 | I21'.
26
+
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(57,5): error TS2322: Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I11 | I21'.
27
27
Type '{ commonMethodDifferentReturnType: (a: string, b: number) => string | number; }' is not assignable to type 'I21'.
28
28
Types of property 'commonMethodDifferentReturnType' are incompatible.
29
29
Type '(a: string, b: number) => string | number' is not assignable to type '(a: string, b: number) => number'.
// Since T is union Type we only allow the assignment of either object with property of type string or object with property of type number but do not allow object with property of type string | number
48
48
var objStrOrNum3: { prop: string } | { prop: number } = {
49
49
~~~~~~~~~~~~
50
-
!!! error TS2323: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
51
-
!!! error TS2323: Type '{ prop: string | number; }' is not assignable to type '{ prop: number; }'.
52
-
!!! error TS2323: Types of property 'prop' are incompatible.
53
-
!!! error TS2323: Type 'string | number' is not assignable to type 'number'.
54
-
!!! error TS2323: Type 'string' is not assignable to type 'number'.
50
+
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; } | { prop: number; }'.
51
+
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: number; }'.
52
+
!!! error TS2322: Types of property 'prop' are incompatible.
53
+
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
54
+
!!! error TS2322: Type 'string' is not assignable to type 'number'.
55
55
prop: strOrNumber
56
56
};
57
57
var objStrOrNum4: { prop: string | number } = {
58
58
prop: strOrNumber
59
59
};
60
60
var objStrOrNum5: { prop: string; anotherP: string; } | { prop: number } = { prop: strOrNumber };
61
61
~~~~~~~~~~~~
62
-
!!! error TS2323: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
63
-
!!! error TS2323: Type '{ prop: string | number; }' is not assignable to type '{ prop: number; }'.
64
-
!!! error TS2323: Types of property 'prop' are incompatible.
65
-
!!! error TS2323: Type 'string | number' is not assignable to type 'number'.
66
-
!!! error TS2323: Type 'string' is not assignable to type 'number'.
62
+
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
63
+
!!! error TS2322: Type '{ prop: string | number; }' is not assignable to type '{ prop: number; }'.
64
+
!!! error TS2322: Types of property 'prop' are incompatible.
65
+
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
66
+
!!! error TS2322: Type 'string' is not assignable to type 'number'.
67
67
var objStrOrNum6: { prop: string; anotherP: string; } | { prop: number } = {
68
68
~~~~~~~~~~~~
69
-
!!! error TS2323: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
70
-
!!! error TS2323: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; }'.
71
-
!!! error TS2323: Types of property 'prop' are incompatible.
72
-
!!! error TS2323: Type 'string | number' is not assignable to type 'number'.
73
-
!!! error TS2323: Type 'string' is not assignable to type 'number'.
69
+
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
70
+
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; }'.
71
+
!!! error TS2322: Types of property 'prop' are incompatible.
72
+
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
73
+
!!! error TS2322: Type 'string' is not assignable to type 'number'.
74
74
prop: strOrNumber,
75
75
anotherP: str
76
76
};
77
77
var objStrOrNum7: { prop: string; anotherP: string; } | { prop: number; anotherP1: number } = {
78
78
~~~~~~~~~~~~
79
-
!!! error TS2323: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
80
-
!!! error TS2323: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
81
-
!!! error TS2323: Types of property 'prop' are incompatible.
82
-
!!! error TS2323: Type 'string | number' is not assignable to type 'number'.
83
-
!!! error TS2323: Type 'string' is not assignable to type 'number'.
79
+
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
80
+
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
81
+
!!! error TS2322: Types of property 'prop' are incompatible.
82
+
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
83
+
!!! error TS2322: Type 'string' is not assignable to type 'number'.
84
84
prop: strOrNumber,
85
85
anotherP: str
86
86
};
87
87
var objStrOrNum8: { prop: string; anotherP: string; } | { prop: number; anotherP1: number } = {
88
88
~~~~~~~~~~~~
89
-
!!! error TS2323: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
90
-
!!! error TS2323: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
91
-
!!! error TS2323: Types of property 'prop' are incompatible.
92
-
!!! error TS2323: Type 'string | number' is not assignable to type 'number'.
93
-
!!! error TS2323: Type 'string' is not assignable to type 'number'.
89
+
!!! error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
90
+
!!! error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
91
+
!!! error TS2322: Types of property 'prop' are incompatible.
92
+
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
93
+
!!! error TS2322: Type 'string' is not assignable to type 'number'.
0 commit comments