Trim indexed access and type variable constraint error output (#43540)

This commit is contained in:
Wesley Wigham 2021-04-13 13:13:32 -07:00 committed by GitHub
parent 06a73655d0
commit 6002cff776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 135 additions and 136 deletions

View File

@ -18263,6 +18263,20 @@ namespace ts {
}
}
else if (target.flags & TypeFlags.IndexedAccess) {
if (source.flags & TypeFlags.IndexedAccess) {
// Relate components directly before falling back to constraint relationships
// A type S[K] is related to a type T[J] if S is related to T and K is related to J.
if (result = isRelatedTo((<IndexedAccessType>source).objectType, (<IndexedAccessType>target).objectType, reportErrors)) {
result &= isRelatedTo((<IndexedAccessType>source).indexType, (<IndexedAccessType>target).indexType, reportErrors);
}
if (result) {
resetErrorInfo(saveErrorInfo);
return result;
}
if (reportErrors) {
originalErrorInfo = errorInfo;
}
}
// A type S is related to a type T[K] if S is related to C, where C is the base
// constraint of T[K] for writing.
if (relation === assignableRelation || relation === comparableRelation) {
@ -18273,11 +18287,24 @@ namespace ts {
if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
const accessFlags = AccessFlags.Writing | (baseObjectType !== objectType ? AccessFlags.NoIndexSignatures : 0);
const constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, (<IndexedAccessType>target).noUncheckedIndexedAccessCandidate, /*accessNode*/ undefined, accessFlags);
if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) {
return result;
if (constraint) {
if (reportErrors && originalErrorInfo) {
// create a new chain for the constraint error
resetErrorInfo(saveErrorInfo);
}
if (result = isRelatedTo(source, constraint, reportErrors)) {
return result;
}
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
if (reportErrors && originalErrorInfo && errorInfo) {
errorInfo = countMessageChainBreadth([originalErrorInfo]) <= countMessageChainBreadth([errorInfo]) ? originalErrorInfo : errorInfo;
}
}
}
}
if (reportErrors) {
originalErrorInfo = undefined;
}
}
else if (isGenericMappedType(target) && !target.declaration.nameType) {
// A source type T is related to a target type { [P in X]: T[P] }
@ -18365,17 +18392,8 @@ namespace ts {
}
if (source.flags & TypeFlags.TypeVariable) {
if (source.flags & TypeFlags.IndexedAccess && target.flags & TypeFlags.IndexedAccess) {
// A type S[K] is related to a type T[J] if S is related to T and K is related to J.
if (result = isRelatedTo((<IndexedAccessType>source).objectType, (<IndexedAccessType>target).objectType, reportErrors)) {
result &= isRelatedTo((<IndexedAccessType>source).indexType, (<IndexedAccessType>target).indexType, reportErrors);
}
if (result) {
resetErrorInfo(saveErrorInfo);
return result;
}
}
else {
// IndexedAccess comparisons are handled above in the `target.flags & TypeFlage.IndexedAccess` branch
if (!(source.flags & TypeFlags.IndexedAccess && target.flags & TypeFlags.IndexedAccess)) {
const constraint = getConstraintOfType(<TypeVariable>source);
if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) {
// A type variable with no constraint is not related to the non-primitive object type.
@ -18390,7 +18408,7 @@ namespace ts {
return result;
}
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors, /*headMessage*/ undefined, intersectionState)) {
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors && !(target.flags & source.flags & TypeFlags.TypeParameter), /*headMessage*/ undefined, intersectionState)) {
resetErrorInfo(saveErrorInfo);
return result;
}
@ -18561,6 +18579,11 @@ namespace ts {
}
return Ternary.False;
function countMessageChainBreadth(info: DiagnosticMessageChain[] | undefined): number {
if (!info) return 0;
return reduceLeft(info, (value, chain) => value + 1 + countMessageChainBreadth(chain.next), 0);
}
function relateVariances(sourceTypeArguments: readonly Type[] | undefined, targetTypeArguments: readonly Type[] | undefined, variances: VarianceFlags[], intersectionState: IntersectionState) {
if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors, intersectionState)) {
return result;

View File

@ -0,0 +1,18 @@
tests/cases/compiler/errorInfoForRelatedIndexTypesNoConstraintElaboration.ts(6,15): error TS2322: Type 'IntrinsicElements[T1]' is not assignable to type 'IntrinsicElements[T2]'.
Type 'T1' is not assignable to type 'T2'.
'T1' is assignable to the constraint of type 'T2', but 'T2' could be instantiated with a different subtype of constraint 'keyof IntrinsicElements'.
==== tests/cases/compiler/errorInfoForRelatedIndexTypesNoConstraintElaboration.ts (1 errors) ====
/// <reference path="/.lib/react16.d.ts" />
class I<T1 extends keyof JSX.IntrinsicElements, T2 extends keyof JSX.IntrinsicElements> {
M() {
let c1: JSX.IntrinsicElements[T1] = {};
const c2: JSX.IntrinsicElements[T2] = c1;
~~
!!! error TS2322: Type 'IntrinsicElements[T1]' is not assignable to type 'IntrinsicElements[T2]'.
!!! error TS2322: Type 'T1' is not assignable to type 'T2'.
!!! error TS2322: 'T1' is assignable to the constraint of type 'T2', but 'T2' could be instantiated with a different subtype of constraint 'keyof IntrinsicElements'.
}
}

View File

@ -0,0 +1,21 @@
//// [errorInfoForRelatedIndexTypesNoConstraintElaboration.ts]
/// <reference path="/.lib/react16.d.ts" />
class I<T1 extends keyof JSX.IntrinsicElements, T2 extends keyof JSX.IntrinsicElements> {
M() {
let c1: JSX.IntrinsicElements[T1] = {};
const c2: JSX.IntrinsicElements[T2] = c1;
}
}
//// [errorInfoForRelatedIndexTypesNoConstraintElaboration.js]
/// <reference path="react16.d.ts" />
var I = /** @class */ (function () {
function I() {
}
I.prototype.M = function () {
var c1 = {};
var c2 = c1;
};
return I;
}());

View File

@ -0,0 +1,29 @@
=== tests/cases/compiler/errorInfoForRelatedIndexTypesNoConstraintElaboration.ts ===
/// <reference path="react16.d.ts" />
class I<T1 extends keyof JSX.IntrinsicElements, T2 extends keyof JSX.IntrinsicElements> {
>I : Symbol(I, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 0, 0))
>T1 : Symbol(T1, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 2, 8))
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12))
>IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(react16.d.ts, 2514, 86))
>T2 : Symbol(T2, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 2, 47))
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12))
>IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(react16.d.ts, 2514, 86))
M() {
>M : Symbol(I.M, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 2, 89))
let c1: JSX.IntrinsicElements[T1] = {};
>c1 : Symbol(c1, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 4, 11))
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12))
>IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(react16.d.ts, 2514, 86))
>T1 : Symbol(T1, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 2, 8))
const c2: JSX.IntrinsicElements[T2] = c1;
>c2 : Symbol(c2, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 5, 13))
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12))
>IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(react16.d.ts, 2514, 86))
>T2 : Symbol(T2, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 2, 47))
>c1 : Symbol(c1, Decl(errorInfoForRelatedIndexTypesNoConstraintElaboration.ts, 4, 11))
}
}

View File

@ -0,0 +1,22 @@
=== tests/cases/compiler/errorInfoForRelatedIndexTypesNoConstraintElaboration.ts ===
/// <reference path="react16.d.ts" />
class I<T1 extends keyof JSX.IntrinsicElements, T2 extends keyof JSX.IntrinsicElements> {
>I : I<T1, T2>
>JSX : any
>JSX : any
M() {
>M : () => void
let c1: JSX.IntrinsicElements[T1] = {};
>c1 : JSX.IntrinsicElements[T1]
>JSX : any
>{} : {}
const c2: JSX.IntrinsicElements[T2] = c1;
>c2 : JSX.IntrinsicElements[T2]
>JSX : any
>c1 : JSX.IntrinsicElements[T1]
}
}

View File

@ -4,8 +4,6 @@ tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Conversion o
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Conversion of type 'U' to type 'T' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not comparable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
==== tests/cases/compiler/genericTypeAssertions6.ts (3 errors) ====
@ -37,8 +35,6 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Conversion
~~~~~~~~~~~~~~~~
!!! error TS2352: Conversion of type 'U' to type 'T' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
!!! error TS2352: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2352: Type 'Date' is not comparable to type 'T'.
!!! error TS2352: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
}
}

View File

@ -8,8 +8,6 @@ tests/cases/conformance/types/typeAliases/intrinsicTypes.ts(42,5): error TS2322:
tests/cases/conformance/types/typeAliases/intrinsicTypes.ts(43,5): error TS2322: Type 'Uppercase<T>' is not assignable to type 'Uppercase<U>'.
Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string'.
Type 'string' is not assignable to type 'U'.
'string' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string'.
==== tests/cases/conformance/types/typeAliases/intrinsicTypes.ts (8 errors) ====
@ -74,8 +72,6 @@ tests/cases/conformance/types/typeAliases/intrinsicTypes.ts(43,5): error TS2322:
!!! error TS2322: Type 'Uppercase<T>' is not assignable to type 'Uppercase<U>'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string'.
!!! error TS2322: Type 'string' is not assignable to type 'U'.
!!! error TS2322: 'string' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string'.
}
function foo2<T extends 'foo' | 'bar'>(x: Uppercase<T>) {

View File

@ -53,12 +53,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(111,5): error
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(114,5): error TS2322: Type 'T[K]' is not assignable to type 'T[J]'.
Type 'K' is not assignable to type 'J'.
'K' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
Type 'Extract<keyof T, string>' is not assignable to type 'J'.
'Extract<keyof T, string>' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
Type 'string & keyof T' is not assignable to type 'J'.
'string & keyof T' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
Type 'string' is not assignable to type 'J'.
'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error TS2322: Type 'T[K]' is not assignable to type 'U[J]'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
@ -273,12 +267,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error
!!! error TS2322: Type 'T[K]' is not assignable to type 'T[J]'.
!!! error TS2322: Type 'K' is not assignable to type 'J'.
!!! error TS2322: 'K' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
!!! error TS2322: Type 'Extract<keyof T, string>' is not assignable to type 'J'.
!!! error TS2322: 'Extract<keyof T, string>' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
!!! error TS2322: Type 'string & keyof T' is not assignable to type 'J'.
!!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
!!! error TS2322: Type 'string' is not assignable to type 'J'.
!!! error TS2322: 'string' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'.
tk = uj;
uj = tk; // error

View File

@ -6,16 +6,10 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(30,5): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List<number>'.
Type 'MyList<number>' is not assignable to type 'T'.
'MyList<number>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List<number>'.
tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(31,5): error TS2322: Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList<number>'.
Type 'List<number>' is not assignable to type 'U'.
'List<number>' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList<number>'.
tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(42,5): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList<number>'.
Type 'MyList<number>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'MyList<number>'.
==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts (5 errors) ====
@ -60,14 +54,10 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List<number>'.
!!! error TS2322: Type 'MyList<number>' is not assignable to type 'T'.
!!! error TS2322: 'MyList<number>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List<number>'.
u = t; // error
~
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList<number>'.
!!! error TS2322: Type 'List<number>' is not assignable to type 'U'.
!!! error TS2322: 'List<number>' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList<number>'.
var a: List<number>;
var b: MyList<number>;
@ -82,8 +72,6 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList<number>'.
!!! error TS2322: Type 'MyList<number>' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'MyList<number>'.
u = t; // was error, ok after constraint made illegal, doesn't matter
var a: List<number>;

View File

@ -18,22 +18,14 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2416: Property 'foo' in type 'D19<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'V' is not assignable to type 'T'.
'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(134,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(134,5): error TS2416: Property 'foo' in type 'D23<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
Type 'V' is not assignable to type 'T'.
'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(139,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(139,5): error TS2416: Property 'foo' in type 'D24<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
Type 'V' is not assignable to type 'U'.
'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'U'.
'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(156,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(156,5): error TS2416: Property 'foo' in type 'D27<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
Type 'Date' is not assignable to type 'T'.
@ -191,10 +183,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D19<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
!!! error TS2416: Type 'U' is not assignable to type 'T'.
!!! error TS2416: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2416: Type 'V' is not assignable to type 'T'.
!!! error TS2416: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2416: Type 'Date' is not assignable to type 'T'.
!!! error TS2416: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
}
class D20<T extends U, U extends V, V extends Date> extends C3<U> {
@ -223,8 +211,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D23<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
!!! error TS2416: Type 'V' is not assignable to type 'T'.
!!! error TS2416: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2416: Type 'Date' is not assignable to type 'T'.
!!! error TS2416: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
}
class D24<T extends U, U extends V, V extends Date> extends C3<U> {
@ -236,8 +222,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D24<T, U, V>' is not assignable to the same property in base type 'C3<U>'.
!!! error TS2416: Type 'V' is not assignable to type 'U'.
!!! error TS2416: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2416: Type 'Date' is not assignable to type 'U'.
!!! error TS2416: 'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
}
class D25<T extends U, U extends V, V extends Date> extends C3<V> {

View File

@ -5,8 +5,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2416: Property 'foo' in type 'D5<T, U, V>' is not assignable to the same property in base type 'B1<T>'.
Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'.
Type 'Foo' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(62,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(62,5): error TS2416: Property 'foo' in type 'D6<T, U, V>' is not assignable to the same property in base type 'B1<T>'.
Type 'V' is not assignable to type 'T'.
@ -15,8 +13,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2416: Property 'foo' in type 'D7<T, U, V>' is not assignable to the same property in base type 'B1<U>'.
Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'.
Type 'Foo' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(77,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(77,5): error TS2416: Property 'foo' in type 'D9<T, U, V>' is not assignable to the same property in base type 'B1<U>'.
Type 'V' is not assignable to type 'U'.
@ -92,8 +88,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D5<T, U, V>' is not assignable to the same property in base type 'B1<T>'.
!!! error TS2416: Type 'U' is not assignable to type 'T'.
!!! error TS2416: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'.
!!! error TS2416: Type 'Foo' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
}
class D6<T extends Foo, U extends Foo, V> extends B1<T> {
@ -116,8 +110,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D7<T, U, V>' is not assignable to the same property in base type 'B1<U>'.
!!! error TS2416: Type 'T' is not assignable to type 'U'.
!!! error TS2416: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'.
!!! error TS2416: Type 'Foo' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
}
class D8<T extends Foo, U extends Foo, V> extends B1<U> {

View File

@ -2,8 +2,6 @@ tests/cases/conformance/types/literal/templateLiteralTypes1.ts(40,5): error TS23
tests/cases/conformance/types/literal/templateLiteralTypes1.ts(45,5): error TS2322: Type '{ [P in B as `p_${P}`]: T; }' is not assignable to type '{ [Q in A as `p_${Q}`]: U; }'.
Type 'A' is not assignable to type 'B'.
'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint 'string'.
Type 'string' is not assignable to type 'B'.
'string' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint 'string'.
tests/cases/conformance/types/literal/templateLiteralTypes1.ts(165,15): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
tests/cases/conformance/types/literal/templateLiteralTypes1.ts(197,16): error TS2590: Expression produces a union type that is too complex to represent.
tests/cases/conformance/types/literal/templateLiteralTypes1.ts(201,16): error TS2590: Expression produces a union type that is too complex to represent.
@ -62,8 +60,6 @@ tests/cases/conformance/types/literal/templateLiteralTypes1.ts(205,16): error TS
!!! error TS2322: Type '{ [P in B as `p_${P}`]: T; }' is not assignable to type '{ [Q in A as `p_${Q}`]: U; }'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint 'string'.
!!! error TS2322: Type 'string' is not assignable to type 'B'.
!!! error TS2322: 'string' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint 'string'.
}
// String transformations using recursive conditional types

View File

@ -10,36 +10,24 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(25,5): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'V' is not assignable to type 'T'.
'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(26,5): error TS2322: Type 'V' is not assignable to type 'T'.
'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(27,5): error TS2322: Type 'Date' is not assignable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(30,5): error TS2322: Type 'V' is not assignable to type 'U'.
'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'U'.
'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(31,5): error TS2322: Type 'Date' is not assignable to type 'U'.
'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(35,5): error TS2322: Type 'Date' is not assignable to type 'V'.
'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(45,5): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'V' is not assignable to type 'T'.
'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(46,5): error TS2322: Type 'V' is not assignable to type 'T'.
'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(47,5): error TS2322: Type 'Date' is not assignable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(50,5): error TS2322: Type 'V' is not assignable to type 'U'.
'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'U'.
'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(51,5): error TS2322: Type 'Date' is not assignable to type 'U'.
'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(55,5): error TS2322: Type 'Date' is not assignable to type 'V'.
@ -100,10 +88,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2322: Type 'V' is not assignable to type 'T'.
!!! error TS2322: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2322: Type 'Date' is not assignable to type 'T'.
!!! error TS2322: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
t = v; // error
~
!!! error TS2322: Type 'V' is not assignable to type 'T'.
@ -118,8 +102,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~
!!! error TS2322: Type 'V' is not assignable to type 'U'.
!!! error TS2322: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2322: Type 'Date' is not assignable to type 'U'.
!!! error TS2322: 'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
u = new Date(); // error
~
!!! error TS2322: Type 'Date' is not assignable to type 'U'.
@ -144,10 +126,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2322: Type 'V' is not assignable to type 'T'.
!!! error TS2322: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2322: Type 'Date' is not assignable to type 'T'.
!!! error TS2322: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
t = v; // error
~
!!! error TS2322: Type 'V' is not assignable to type 'T'.
@ -162,8 +140,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~
!!! error TS2322: Type 'V' is not assignable to type 'U'.
!!! error TS2322: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2322: Type 'Date' is not assignable to type 'U'.
!!! error TS2322: 'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'.
u = new Date(); // error
~
!!! error TS2322: Type 'Date' is not assignable to type 'U'.

View File

@ -1,19 +1,11 @@
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(14,5): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'.
Type 'Foo' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(15,5): error TS2322: Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'.
Type 'Foo' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(22,9): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'.
Type 'Foo' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(23,9): error TS2322: Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'.
Type 'Foo' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts (4 errors) ====
@ -34,14 +26,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'.
!!! error TS2322: Type 'Foo' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
u = t; // error
~
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'.
!!! error TS2322: Type 'Foo' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
}
class C<T extends Foo, U extends Foo> {
@ -52,13 +40,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~~~~~~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'.
!!! error TS2322: Type 'Foo' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
this.u = this.t; // error
~~~~~~
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'.
!!! error TS2322: Type 'Foo' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo'.
}
}

View File

@ -1,7 +1,5 @@
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
Type 'Date' is not assignable to type 'T'.
'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(5,5): error TS2322: Type 'V' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(6,5): error TS2322: Type 'T' is not assignable to type 'V'.
@ -22,8 +20,6 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
!!! error TS2322: Type 'Date' is not assignable to type 'T'.
!!! error TS2322: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'.
x = z; // Error
~
!!! error TS2322: Type 'V' is not assignable to type 'T'.

View File

@ -1,8 +1,5 @@
tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'.
'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Object'.
Type 'Object' is not assignable to type 'T'.
'Object' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Object'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'.
'Object' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Object'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
@ -16,9 +13,6 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Object'.
!!! error TS2322: Type 'Object' is not assignable to type 'T'.
!!! error TS2322: 'Object' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Object'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
x = z; // Ok
~
!!! error TS2322: Type 'Object' is not assignable to type 'T'.

View File

@ -11,8 +11,6 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(151,5): error TS2322: Typ
tests/cases/conformance/types/tuple/variadicTuples1.ts(152,5): error TS2322: Type '[string, ...T]' is not assignable to type '[string, ...U]'.
Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string[]'.
Type 'string[]' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'string[]'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(160,5): error TS2322: Type 'readonly [...T]' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'readonly [...T]'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(162,5): error TS4104: The type 'readonly [...T]' is 'readonly' and cannot be assigned to the mutable type '[...T]'.
@ -27,8 +25,6 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(181,5): error TS2322: Typ
tests/cases/conformance/types/tuple/variadicTuples1.ts(182,5): error TS2322: Type '[...T]' is not assignable to type '[...U]'.
Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string[]'.
Type 'string[]' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'string[]'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(188,5): error TS2322: Type 'T' is not assignable to type '[...T]'.
The type 'readonly string[]' is 'readonly' and cannot be assigned to the mutable type '[...T]'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(190,5): error TS2322: Type 'T' is not assignable to type '[...U]'.
@ -36,8 +32,6 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(190,5): error TS2322: Typ
tests/cases/conformance/types/tuple/variadicTuples1.ts(191,5): error TS2322: Type '[...T]' is not assignable to type '[...U]'.
Type 'T' is not assignable to type 'U'.
'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'readonly string[]'.
Type 'readonly string[]' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'readonly string[]'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(203,5): error TS2322: Type 'string' is not assignable to type 'keyof [1, 2, ...T]'.
Type '"2"' is not assignable to type 'number | "0" | keyof T[] | "1"'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(357,26): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
@ -220,8 +214,6 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(397,7): error TS2322: Typ
!!! error TS2322: Type '[string, ...T]' is not assignable to type '[string, ...U]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string[]'.
!!! error TS2322: Type 'string[]' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'string[]'.
}
// For a generic type T, [...T] is assignable to T, T is assignable to readonly [...T], and T is assignable
@ -273,8 +265,6 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(397,7): error TS2322: Typ
!!! error TS2322: Type '[...T]' is not assignable to type '[...U]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'string[]'.
!!! error TS2322: Type 'string[]' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'string[]'.
}
function f14<T extends readonly string[], U extends T>(t0: T, t1: [...T], t2: [...U]) {
@ -294,8 +284,6 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(397,7): error TS2322: Typ
!!! error TS2322: Type '[...T]' is not assignable to type '[...U]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'readonly string[]'.
!!! error TS2322: Type 'readonly string[]' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'readonly string[]'.
}
function f15<T extends string[], U extends T>(k0: keyof T, k1: keyof [...T], k2: keyof [...U], k3: keyof [1, 2, ...T]) {

View File

@ -0,0 +1,8 @@
/// <reference path="/.lib/react16.d.ts" />
class I<T1 extends keyof JSX.IntrinsicElements, T2 extends keyof JSX.IntrinsicElements> {
M() {
let c1: JSX.IntrinsicElements[T1] = {};
const c2: JSX.IntrinsicElements[T2] = c1;
}
}