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: src/compiler/checker.ts
+13-16Lines changed: 13 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -18219,18 +18219,18 @@ namespace ts {
18219
18219
return result;
18220
18220
}
18221
18221
18222
-
if (isNonAugmentingArraySubtype(source) && isArrayType(target)) {
18223
-
let sourceBase = getBaseTypes((source as TypeReference).target as InterfaceType)[0];
18224
-
if (length(target.resolvedTypeArguments) === 2) {
18225
-
sourceBase = getTypeWithThisArgument(sourceBase, ((source as TypeReference).target as InterfaceType).thisType);
18222
+
let sourceBase = getSingleBaseForNonAugmentingSubtype(source);
18223
+
if (sourceBase) {
18224
+
if (getObjectFlags(target) & ObjectFlags.Reference && length(getTypeArguments((target as TypeReference))) > length((target as TypeReference).target.typeParameters)) {
18225
+
sourceBase = getTypeWithThisArgument(sourceBase, last(getTypeArguments(source as TypeReference)));
if (isArrayType(source) && isNonAugmentingArraySubtype(target)) {
18231
-
let targetBase = getBaseTypes((target as TypeReference).target as InterfaceType)[0];
18232
-
if (length(source.resolvedTypeArguments) === 2) {
18233
-
targetBase = getTypeWithThisArgument(targetBase, ((target as TypeReference).target as InterfaceType).thisType);
18230
+
let targetBase = getSingleBaseForNonAugmentingSubtype(target);
18231
+
if (targetBase) {
18232
+
if (getObjectFlags(source) & ObjectFlags.Reference && length(getTypeArguments((source as TypeReference))) > length((source as TypeReference).target.typeParameters)) {
18233
+
targetBase = getTypeWithThisArgument(targetBase, last(getTypeArguments(target as TypeReference)));
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(81,5): error TS2322: Type 'Base' is not assignable to type '{ foo: string; }'.
18
18
Property 'foo' is private in type 'Base' but not in type '{ foo: string; }'.
19
19
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(82,5): error TS2322: Type 'I' is not assignable to type '{ foo: string; }'.
20
-
Property 'foo' is private in type 'I' but not in type '{ foo: string; }'.
20
+
Type 'Base' is not assignable to type '{ foo: string; }'.
21
21
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(84,5): error TS2322: Type 'E' is not assignable to type '{ foo: string; }'.
22
22
Property 'foo' is private in type 'E' but not in type '{ foo: string; }'.
23
23
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(86,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'Base'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(89,5): error TS2322: Type 'E' is not assignable to type 'Base'.
28
28
Types have separate declarations of a private property 'foo'.
29
29
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(92,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'I'.
30
-
Property 'foo' is private in type 'I' but not in type '{ foo: string; }'.
30
+
Type '{ foo: string; }' is not assignable to type 'Base'.
31
31
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(94,5): error TS2322: Type 'D' is not assignable to type 'I'.
32
-
Property 'foo' is private in type 'I' but not in type 'D'.
32
+
Type 'D' is not assignable to type 'Base'.
33
33
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(95,5): error TS2322: Type 'E' is not assignable to type 'I'.
34
-
Types have separate declarations of a private property 'foo'.
34
+
Type 'E' is not assignable to type 'Base'.
35
35
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(99,5): error TS2322: Type 'Base' is not assignable to type 'D'.
36
36
Property 'foo' is private in type 'Base' but not in type 'D'.
37
37
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(100,5): error TS2322: Type 'I' is not assignable to type 'D'.
38
-
Property 'foo' is private in type 'I' but not in type 'D'.
38
+
Type 'Base' is not assignable to type 'D'.
39
39
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(101,5): error TS2322: Type 'E' is not assignable to type 'D'.
40
40
Property 'foo' is private in type 'E' but not in type 'D'.
41
41
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(103,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'E'.
42
42
Property 'foo' is private in type 'E' but not in type '{ foo: string; }'.
43
43
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(104,5): error TS2322: Type 'Base' is not assignable to type 'E'.
44
44
Types have separate declarations of a private property 'foo'.
45
45
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(105,5): error TS2322: Type 'I' is not assignable to type 'E'.
46
-
Types have separate declarations of a private property 'foo'.
46
+
Type 'Base' is not assignable to type 'E'.
47
47
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithObjectMembersAccessibility.ts(106,5): error TS2322: Type 'D' is not assignable to type 'E'.
48
48
Property 'foo' is private in type 'E' but not in type 'D'.
Copy file name to clipboardExpand all lines: tests/baselines/reference/checkJsxChildrenProperty5.errors.txt
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
tests/cases/conformance/jsx/file.tsx(20,10): error TS2741: Property 'children' is missing in type '{ a: number; b: string; }' but required in type 'Prop'.
2
-
tests/cases/conformance/jsx/file.tsx(25,9): error TS2740: Type 'Element' is missing the following properties from type 'Button': render, setState, forceUpdate, state, and 2 more.
2
+
tests/cases/conformance/jsx/file.tsx(25,9): error TS2322: Type 'Element' is not assignable to type 'Button'.
3
+
Type 'ReactElement<any>' is missing the following properties from type 'Button': render, setState, forceUpdate, state, and 2 more.
3
4
tests/cases/conformance/jsx/file.tsx(29,10): error TS2740: Type 'typeof Button' is missing the following properties from type 'Button': render, setState, forceUpdate, props, and 3 more.
4
5
5
6
@@ -33,7 +34,8 @@ tests/cases/conformance/jsx/file.tsx(29,10): error TS2740: Type 'typeof Button'
33
34
<Comp a={10} b="hi">
34
35
<Button />
35
36
~~~~~~~~~~
36
-
!!! error TS2740: Type 'Element' is missing the following properties from type 'Button': render, setState, forceUpdate, state, and 2 more.
37
+
!!! error TS2322: Type 'Element' is not assignable to type 'Button'.
38
+
!!! error TS2322: Type 'ReactElement<any>' is missing the following properties from type 'Button': render, setState, forceUpdate, state, and 2 more.
37
39
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:6:5: The expected type comes from property 'children' which is declared here on type 'IntrinsicAttributes & Prop'
Copy file name to clipboardExpand all lines: tests/baselines/reference/checkJsxChildrenProperty7.errors.txt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
tests/cases/conformance/jsx/file.tsx(24,40): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element | Element[]'.
2
+
Type 'string' is not assignable to type 'ReactElement<any>'.
2
3
tests/cases/conformance/jsx/file.tsx(26,22): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element | Element[]'.
3
4
tests/cases/conformance/jsx/file.tsx(27,30): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element | Element[]'.
4
5
@@ -30,6 +31,7 @@ tests/cases/conformance/jsx/file.tsx(27,30): error TS2747: 'Comp' components don
30
31
let k1 = <Comp a={10} b="hi"><Button /> <AnotherButton /></Comp>;
31
32
~~
32
33
!!! error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element | Element[]'.
34
+
!!! error TS2747: Type 'string' is not assignable to type 'ReactElement<any>'.
Copy file name to clipboardExpand all lines: tests/baselines/reference/classImplementsClass4.errors.txt
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
tests/cases/compiler/classImplementsClass4.ts(5,7): error TS2720: Class 'C' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass?
2
2
Property 'x' is missing in type 'C' but required in type 'A'.
3
-
tests/cases/compiler/classImplementsClass4.ts(16,1): error TS2741: Property 'x' is missing in type 'C' but required in type 'C2'.
3
+
tests/cases/compiler/classImplementsClass4.ts(16,1): error TS2322: Type 'C' is not assignable to type 'C2'.
4
+
Property 'x' is missing in type 'C' but required in type 'A'.
Copy file name to clipboardExpand all lines: tests/baselines/reference/classImplementsClass5.errors.txt
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,11 @@
1
1
tests/cases/compiler/classImplementsClass5.ts(5,7): error TS2720: Class 'C' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass?
2
2
Types have separate declarations of a private property 'x'.
3
3
tests/cases/compiler/classImplementsClass5.ts(16,1): error TS2322: Type 'C2' is not assignable to type 'C'.
4
-
Types have separate declarations of a private property 'x'.
4
+
Type 'A' is not assignable to type 'C'.
5
+
Types have separate declarations of a private property 'x'.
5
6
tests/cases/compiler/classImplementsClass5.ts(17,1): error TS2322: Type 'C' is not assignable to type 'C2'.
6
-
Types have separate declarations of a private property 'x'.
7
+
Type 'C' is not assignable to type 'A'.
8
+
Types have separate declarations of a private property 'x'.
Copy file name to clipboardExpand all lines: tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(9,5): error TS2741: Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo' but required in type 'D'.
1
+
tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(9,5): error TS2322: Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D'.
2
+
Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo' but required in type 'C'.
!!! error TS2420: Class 'Bar5' incorrectly implements interface 'I'.
57
-
!!! error TS2420: Property 'y' is missing in type 'Bar5' but required in type 'I'.
58
+
!!! error TS2420: Type 'Foo' is not assignable to type 'I'.
59
+
!!! error TS2420: Property 'y' is missing in type 'Foo' but required in type 'I'.
58
60
!!! related TS2728 tests/cases/conformance/interfaces/interfacesExtendingClasses/implementingAnInterfaceExtendingClassWithProtecteds.ts:6:5: 'y' is declared here.
0 commit comments