From 54ede16611ddcc126ada8e0aec13c60931d1e5cd Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 15 Jan 2019 17:06:36 -0500 Subject: [PATCH 1/3] Added custom error message when trying to assign constraint type to generic type parameter Fixes #29049. This also adds the new message in chained error messages. `typeParameterDiamond4.errors.txt` shows it appearing twice in the "diamond" scenario. I can't tell if this severely increased amount of nested messages is good or bad...? --- src/compiler/checker.ts | 13 +++ src/compiler/diagnosticMessages.json | 4 + ...gnmentCompatWithCallSignatures3.errors.txt | 14 +++ ...gnmentCompatWithCallSignatures4.errors.txt | 8 ++ ...gnmentCompatWithCallSignatures5.errors.txt | 4 + ...gnmentCompatWithCallSignatures6.errors.txt | 2 + ...tCompatWithConstructSignatures3.errors.txt | 14 +++ ...tCompatWithConstructSignatures4.errors.txt | 8 ++ ...tCompatWithConstructSignatures5.errors.txt | 4 + ...tCompatWithConstructSignatures6.errors.txt | 2 + ...ompatWithGenericCallSignatures2.errors.txt | 2 + ...ignaturesWithOptionalParameters.errors.txt | 46 ++++++++++ ...ignmentCompatWithNumericIndexer.errors.txt | 4 + ...gnmentCompatWithNumericIndexer2.errors.txt | 4 + ...gnmentCompatWithNumericIndexer3.errors.txt | 2 + ...signmentCompatWithStringIndexer.errors.txt | 4 + ...ignmentCompatWithStringIndexer2.errors.txt | 4 + .../assignmentStricterConstraints.errors.txt | 2 + .../baseConstraintOfDecorator.errors.txt | 2 + ...atureAssignabilityInInheritance.errors.txt | 2 + ...tureAssignabilityInInheritance3.errors.txt | 4 + ...tureAssignabilityInInheritance6.errors.txt | 20 +++- ...onstrainedToOtherTypeParameter2.errors.txt | 4 + ...maOperatorOtherInvalidOperation.errors.txt | 2 + .../complexRecursiveCollections.errors.txt | 6 ++ .../reference/conditionalTypes1.errors.txt | 28 ++++-- .../reference/conditionalTypes2.errors.txt | 6 ++ ...atureAssignabilityInInheritance.errors.txt | 2 + ...tureAssignabilityInInheritance3.errors.txt | 4 + ...tureAssignabilityInInheritance6.errors.txt | 20 +++- ...mplementationWithDefaultValues2.errors.txt | 6 ++ ...rWithAssignableReturnExpression.errors.txt | 2 + .../derivedGenericClassWithAny.errors.txt | 4 + .../reference/enumAssignability.errors.txt | 8 ++ ...sIntoApparentlyPresentPropsOnly.errors.txt | 2 + ...rrorMessagesIntersectionTypes03.errors.txt | 6 ++ ...ionTypeArgumentAssignmentCompat.errors.txt | 2 + ...cCallWithFunctionTypedArguments.errors.txt | 6 ++ ...lWithGenericSignatureArguments2.errors.txt | 4 + ...thObjectTypeArgsAndConstraints4.errors.txt | 2 + ...thObjectTypeArgsAndConstraints5.errors.txt | 2 + ...thObjectTypeArgsAndInitializers.errors.txt | 12 ++- ...kedInsideItsContainingFunction1.errors.txt | 4 + ...ithFunctionTypedMemberArguments.errors.txt | 6 ++ .../genericDefaultsErrors.errors.txt | 4 + ...CallSignatureReturnTypeMismatch.errors.txt | 2 + .../genericRestParameters1.errors.txt | 4 + .../genericTypeAssertions4.errors.txt | 10 ++ .../genericTypeAssertions5.errors.txt | 10 ++ .../genericTypeAssertions6.errors.txt | 12 ++- .../genericWithOpenTypeParameters1.errors.txt | 2 + .../getAndSetNotIdenticalType2.errors.txt | 2 + ...ementGenericWithMismatchedTypes.errors.txt | 2 + ...signmentOfIdenticallyNamedTypes.errors.txt | 2 + .../indexSignatureAndMappedType.errors.txt | 2 + ...teExpansionThroughInstantiation.errors.txt | 2 + .../intersectionTypeInference.errors.txt | 4 + .../invalidBooleanAssignments.errors.txt | 2 + .../invalidNumberAssignments.errors.txt | 2 + .../invalidStringAssignments.errors.txt | 2 + .../keyofAndIndexedAccessErrors.errors.txt | 54 ++++++++--- .../mappedTypeRelationships.errors.txt | 64 ++++++++++--- .../reference/mappedTypes6.errors.txt | 6 ++ .../nonPrimitiveAndTypeVariables.errors.txt | 2 + .../objectLiteralExcessProperties.errors.txt | 4 + ...WrappedPropertyCheckedNominally.errors.txt | 24 +++-- .../subtypesOfTypeParameter.errors.txt | 2 + ...sOfTypeParameterWithConstraints.errors.txt | 50 ++++++++-- ...OfTypeParameterWithConstraints4.errors.txt | 16 +++- ...aturesWithSpecializedSignatures.errors.txt | 2 + ...btypingWithConstructSignatures6.errors.txt | 20 +++- ...aturesWithSpecializedSignatures.errors.txt | 2 + ...ignaturesWithOptionalParameters.errors.txt | 32 +++++++ ...ignaturesWithOptionalParameters.errors.txt | 32 +++++++ .../subtypingWithNumericIndexer.errors.txt | 4 + .../subtypingWithNumericIndexer2.errors.txt | 4 + .../subtypingWithNumericIndexer3.errors.txt | 4 + .../subtypingWithNumericIndexer5.errors.txt | 4 + .../subtypingWithStringIndexer.errors.txt | 4 + .../subtypingWithStringIndexer2.errors.txt | 4 + .../subtypingWithStringIndexer3.errors.txt | 4 + .../tsxNotUsingApparentTypeOfSFC.errors.txt | 2 + ...OnFunctionsWithNoTypeParameters.errors.txt | 2 + ...ypeParameterArgumentEquivalence.errors.txt | 2 + ...peParameterArgumentEquivalence2.errors.txt | 4 + ...peParameterArgumentEquivalence3.errors.txt | 2 + ...peParameterArgumentEquivalence4.errors.txt | 4 + ...peParameterArgumentEquivalence5.errors.txt | 4 + .../typeParameterAssignability.errors.txt | 4 + .../typeParameterAssignability2.errors.txt | 92 +++++++++++++++---- .../typeParameterAssignability3.errors.txt | 32 +++++-- .../typeParameterAssignmentCompat1.errors.txt | 2 + .../typeParameterDiamond2.errors.txt | 22 +++-- .../typeParameterDiamond3.errors.txt | 42 ++++++--- .../typeParameterDiamond4.errors.txt | 22 +++-- .../typeParametersShouldNotBeEqual.errors.txt | 8 +- ...typeParametersShouldNotBeEqual2.errors.txt | 24 +++-- ...typeParametersShouldNotBeEqual3.errors.txt | 18 ++-- .../reference/typeRelationships.errors.txt | 4 + .../unionTypesAssignability.errors.txt | 20 +++- 100 files changed, 889 insertions(+), 130 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ab460212d53b7..592be14bece9b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11904,6 +11904,19 @@ namespace ts { targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); } + if ( + target.flags & TypeFlags.TypeParameter + && target.immediateBaseConstraint !== undefined + && isTypeAssignableTo(source, target.immediateBaseConstraint) + ) { + reportError( + Diagnostics._0_is_assignable_to_the_constraint_of_type_2_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, + sourceType, + targetType, + typeToString(target.immediateBaseConstraint), + ); + } + if (!message) { if (relation === comparableRelation) { message = Diagnostics.Type_0_is_not_comparable_to_type_1; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index a4bd48e856214..5d74533db239d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3020,6 +3020,10 @@ "category": "Error", "code": 5073 }, + "'{0}' is assignable to the constraint of type '{2}', but '{1}' could be instantiated with a different subtype of constraint '{2}'.": { + "category": "Error", + "code": 5074 + }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt index aeab178743988..7a2534cc58cbd 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt @@ -14,24 +14,30 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(62,1): error TS2322: Type '(x: (arg: Base) => Derived) => Base' is not assignable to type '(x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(65,1): error TS2322: Type '(x: (arg: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(68,1): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(71,1): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(74,1): error TS2322: Type '(...x: Derived[]) => Derived' is not assignable to type '(...x: T[]) => T'. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(77,1): error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '(x: T, y: T) => T'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type '{ foo: string; bar: string; }'. @@ -43,6 +49,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(83,1): error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '(x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. + 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(85,1): error TS2322: Type '(x: { a: T; b: T; }) => T' is not assignable to type '(x: { a: string; b: number; }) => Object'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'. @@ -136,6 +143,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var b6: (x: (arg: T) => U) => T; a6 = b6; // ok b6 = a6; // ok @@ -144,6 +152,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b7: (x: (arg: T) => U) => (r: T) => U; a7 = b7; // ok b7 = a7; // ok @@ -152,6 +161,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; a8 = b8; // ok b8 = a8; // ok @@ -160,6 +170,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b9: (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; a9 = b9; // ok b9 = a9; // ok @@ -168,12 +179,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: (...x: T[]) => T; a10 = b10; // ok b10 = a10; // ok ~~~ !!! error TS2322: Type '(...x: Derived[]) => Derived' is not assignable to type '(...x: T[]) => T'. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. var b11: (x: T, y: T) => T; a11 = b11; // ok b11 = a11; // ok @@ -198,6 +211,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '(x: Base[], y: T) => T'. !!! error TS2322: Type 'Derived[]' is not assignable to type 'T'. +!!! error TS2322: 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. var b14: (x: { a: T; b: T }) => T; a14 = b14; // ok ~~~ diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt index 0a2ae4789895f..54c9b08e2cf7e 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt @@ -5,6 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(52,9): error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. Types of parameters 'arg2' and 'arg2' are incompatible. @@ -15,6 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(58,9): error TS2322: Type '(...x: Base[]) => Base' is not assignable to type '(...x: T[]) => T'. Type 'Base' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(62,9): error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '(x: T, y: T) => T'. @@ -45,6 +47,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(89,9): error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(90,9): error TS2322: Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. Type 'T[]' is not assignable to type 'string[]'. Type 'T' is not assignable to type 'string'. @@ -54,6 +57,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(96,9): error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts (15 errors) ==== @@ -115,6 +119,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; a8 = b8; // error, { foo: number } and Base are incompatible @@ -131,6 +136,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: (...x: T[]) => T; @@ -205,6 +211,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b2 = a2; ~~ !!! error TS2322: Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. @@ -224,5 +231,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt index 57944ae986389..5ef474c7bc505 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt @@ -5,11 +5,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures5.ts(55,1): error TS2322: Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. Types of property 'b' are incompatible. Type 'V' is not assignable to type 'U'. + 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures5.ts(58,1): error TS2322: Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -79,6 +81,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var b15: (x: { a: U; b: V; }) => U[]; a15 = b15; // ok, T = U, T = V b15 = a15; // ok @@ -88,6 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. !!! error TS2322: Types of property 'b' are incompatible. !!! error TS2322: Type 'V' is not assignable to type 'U'. +!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. var b16: (x: { a: T; b: T }) => T[]; a15 = b16; // ok b15 = a16; // ok diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt index e3d7fda7ba35f..f21c5ee8f94cf 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt @@ -5,6 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures6.ts(42,1): error TS2322: Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: T; b: T; }) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -61,6 +62,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var b16: (x: { a: T; b: T }) => T[]; x.a16 = b16; b16 = x.a16; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt index 1db469b6a4fa7..665e0e7d1fce5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt @@ -14,24 +14,30 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(62,1): error TS2322: Type 'new (x: (arg: Base) => Derived) => Base' is not assignable to type 'new (x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(65,1): error TS2322: Type 'new (x: (arg: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(68,1): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(71,1): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(74,1): error TS2322: Type 'new (...x: Derived[]) => Derived' is not assignable to type 'new (...x: T[]) => T'. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(77,1): error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new (x: T, y: T) => T'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type '{ foo: string; bar: string; }'. @@ -43,6 +49,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(83,1): error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new (x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. + 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(85,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T' is not assignable to type 'new (x: { a: string; b: number; }) => Object'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'. @@ -136,6 +143,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var b6: new (x: (arg: T) => U) => T; a6 = b6; // ok b6 = a6; // ok @@ -144,6 +152,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b7: new (x: (arg: T) => U) => (r: T) => U; a7 = b7; // ok b7 = a7; // ok @@ -152,6 +161,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; a8 = b8; // ok b8 = a8; // ok @@ -160,6 +170,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; a9 = b9; // ok b9 = a9; // ok @@ -168,12 +179,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: new (...x: T[]) => T; a10 = b10; // ok b10 = a10; // ok ~~~ !!! error TS2322: Type 'new (...x: Derived[]) => Derived' is not assignable to type 'new (...x: T[]) => T'. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. var b11: new (x: T, y: T) => T; a11 = b11; // ok b11 = a11; // ok @@ -198,6 +211,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new (x: Base[], y: T) => T'. !!! error TS2322: Type 'Derived[]' is not assignable to type 'T'. +!!! error TS2322: 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. var b14: new (x: { a: T; b: T }) => T; a14 = b14; // ok ~~~ diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index 620e83e1603b8..fcae017d6da7d 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -5,6 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(52,9): error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. Types of parameters 'arg2' and 'arg2' are incompatible. @@ -15,6 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(58,9): error TS2322: Type 'new (...x: Base[]) => Base' is not assignable to type 'new (...x: T[]) => T'. Type 'Base' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(62,9): error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new (x: T, y: T) => T'. @@ -61,6 +63,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(89,9): error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(90,9): error TS2322: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. Type 'T[]' is not assignable to type 'string[]'. Type 'T' is not assignable to type 'string'. @@ -70,6 +73,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(96,9): error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (19 errors) ==== @@ -131,6 +135,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; a8 = b8; // error, type mismatch @@ -147,6 +152,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: new (...x: T[]) => T; @@ -241,6 +247,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b2 = a2; // ok ~~ !!! error TS2322: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. @@ -260,5 +267,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt index 5445d9ee35a14..2fd7217076fc4 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt @@ -5,11 +5,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures5.ts(55,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. Types of property 'b' are incompatible. Type 'V' is not assignable to type 'U'. + 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures5.ts(58,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -79,6 +81,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var b15: new (x: { a: U; b: V; }) => U[]; a15 = b15; // ok b15 = a15; // ok @@ -88,6 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. !!! error TS2322: Types of property 'b' are incompatible. !!! error TS2322: Type 'V' is not assignable to type 'U'. +!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. var b16: new (x: { a: T; b: T }) => T[]; a15 = b16; // ok b15 = a16; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt index 399a56e413659..f73d7fd9d32f5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt @@ -5,6 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures6.ts(42,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: T; b: T; }) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -61,6 +62,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var b16: new (x: { a: T; b: T }) => T[]; x.a16 = b16; b16 = x.a16; diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt index 38f03ca68c441..7d7da35a1200d 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt @@ -1,6 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures2.ts(15,1): error TS2322: Type 'B' is not assignable to type 'A'. Types of parameters 'y' and 'y' are incompatible. Type 'T[]' is not assignable to type 'T'. + 'T[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures2.ts(16,1): error TS2322: Type 'A' is not assignable to type 'B'. Types of parameters 'y' and 'y' are incompatible. Type 'S' is not assignable to type 'S[]'. @@ -26,6 +27,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'B' is not assignable to type 'A'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T[]' is not assignable to type 'T'. +!!! error TS2322: 'T[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b = a; ~ !!! error TS2322: Type 'A' is not assignable to type 'B'. diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt index dbad415c5f83d..3705c3b6ab2b9 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -2,68 +2,91 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(23,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(63,9): error TS2322: Type '() => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(64,9): error TS2322: Type '(x?: T) => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(65,9): error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(66,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(67,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(69,9): error TS2322: Type '() => T' is not assignable to type '(x?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(70,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(71,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(72,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(73,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(75,9): error TS2322: Type '() => T' is not assignable to type '(x: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(76,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(77,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(78,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(79,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(81,9): error TS2322: Type '() => T' is not assignable to type '(x: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(82,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(83,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(84,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(85,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(87,9): error TS2322: Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(88,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(89,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(90,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(91,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(107,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(116,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. @@ -139,10 +162,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type '() => T' is not assignable to type '() => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a = t.a2; ~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '() => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a = t.a3; ~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. @@ -153,106 +178,127 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '() => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } } diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt index 9f60ca5500221..835c6b3ee8a22 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -14,6 +15,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -66,6 +68,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b = a; // error ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. @@ -79,6 +82,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b2 = a; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt index e063a16fd3f4c..0f25602abf9ed 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -14,6 +15,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -66,6 +68,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b = a; // error ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. @@ -79,6 +82,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b2 = a; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt index 845edafd82ca8..291262932b00e 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(33,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts (3 errors) ==== @@ -57,6 +58,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. b = a; // ok var b2: { [x: number]: T; }; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt index 523c6b9733774..34ba4da56b811 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt @@ -13,6 +13,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -20,6 +21,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -94,6 +96,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b3 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. @@ -107,6 +110,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b4 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt index 180012decc2dd..70e550008a189 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt @@ -13,6 +13,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -20,6 +21,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -94,6 +96,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b3 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. @@ -107,6 +110,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. b4 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentStricterConstraints.errors.txt b/tests/baselines/reference/assignmentStricterConstraints.errors.txt index c83e2fa3440d0..f54e852a46826 100644 --- a/tests/baselines/reference/assignmentStricterConstraints.errors.txt +++ b/tests/baselines/reference/assignmentStricterConstraints.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/assignmentStricterConstraints.ts(7,1): error TS2322: Type '(x: T, y: S) => void' is not assignable to type '(x: T, y: S) => void'. Types of parameters 'y' and 'y' are incompatible. Type 'S' is not assignable to type 'T'. + 'S' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/assignmentStricterConstraints.ts (1 errors) ==== @@ -15,5 +16,6 @@ tests/cases/compiler/assignmentStricterConstraints.ts(7,1): error TS2322: Type ' !!! error TS2322: Type '(x: T, y: S) => void' is not assignable to type '(x: T, y: S) => void'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'S' is not assignable to type 'T'. +!!! error TS2322: 'S' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. g(1, "") \ No newline at end of file diff --git a/tests/baselines/reference/baseConstraintOfDecorator.errors.txt b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt index 3af8756fac29a..1a498f3cc3b26 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.errors.txt +++ b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/baseConstraintOfDecorator.ts(2,5): error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. + 'typeof decoratorFunc' is assignable to the constraint of type '{}', but 'TFunction' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/baseConstraintOfDecorator.ts(2,40): error TS2507: Type 'TFunction' is not a constructor function type. tests/cases/compiler/baseConstraintOfDecorator.ts(12,5): error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. tests/cases/compiler/baseConstraintOfDecorator.ts(12,40): error TS2507: Type 'TFunction' is not a constructor function type. @@ -22,6 +23,7 @@ tests/cases/compiler/baseConstraintOfDecorator.ts(12,40): error TS2507: Type 'TF }; ~~~~~~ !!! error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. +!!! error TS2322: 'typeof decoratorFunc' is assignable to the constraint of type '{}', but 'TFunction' could be instantiated with a different subtype of constraint '{}'. } class MyClass { private x; } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt index 3d9ecd65e3d89..d8db30bbe7094 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt @@ -6,6 +6,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Types of property 'a2' are incompatible. Type '(x: T) => string' is not assignable to type '(x: T) => T'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts (2 errors) ==== @@ -82,6 +83,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: T) => string' is not assignable to type '(x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt index 33af0d9f4bf0f..d44708895a32e 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt @@ -3,6 +3,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(60,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. @@ -30,6 +31,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(109,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'. Types of property 'a2' are incompatible. Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. @@ -95,6 +97,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'number' is not assignable to type 'T'. +!!! error TS2430: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -175,6 +178,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. !!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => string[]; // error } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt index 602e40dfcfb57..8869a60c1099e 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt @@ -3,27 +3,32 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '(x: T) => T[]' is not assignable to type '(x: T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(28,11): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type '(x: T) => string[]' is not assignable to type '(x: T) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(32,11): error TS2430: Interface 'I3' incorrectly extends interface 'A'. Types of property 'a3' are incompatible. Type '(x: T) => T' is not assignable to type '(x: T) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(36,11): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a4' are incompatible. Type '(x: T, y: U) => string' is not assignable to type '(x: T, y: U) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(40,11): error TS2430: Interface 'I5' incorrectly extends interface 'A'. Types of property 'a5' are incompatible. Type '(x: (arg: T) => U) => T' is not assignable to type '(x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(44,11): error TS2430: Interface 'I7' incorrectly extends interface 'A'. Types of property 'a11' are incompatible. Type '(x: { foo: T; }, y: { foo: U; bar: U; }) => Base' is not assignable to type '(x: { foo: T; }, y: { foo: T; bar: T; }) => Base'. @@ -31,6 +36,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'foo' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(48,11): error TS2430: Interface 'I9' incorrectly extends interface 'A'. Types of property 'a16' are incompatible. Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: T; b: T; }) => T[]'. @@ -38,7 +44,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'a' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - Type 'Base' is not assignable to type 'T'. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts (7 errors) ==== @@ -72,6 +80,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => T[]' is not assignable to type '(x: T) => T[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a: (x: T) => T[]; } @@ -82,6 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => string[]' is not assignable to type '(x: T) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => string[]; } @@ -92,6 +102,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x: T) => void'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: (x: T) => T; } @@ -102,6 +113,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T, y: U) => string' is not assignable to type '(x: T, y: U) => string'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x: T, y: U) => string; } @@ -113,6 +125,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x: (arg: T) => U) => T; } @@ -125,6 +138,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'foo' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; } @@ -137,6 +151,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: Type 'Base' is not assignable to type 'T'. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: Type 'Base' is not assignable to type 'T'. +!!! error TS2430: 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a16: (x: { a: T; b: T }) => T[]; } \ No newline at end of file diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt index 6f03e711886ba..115fce7ff6ef4 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(7,49): error TS2322: Type 'T' is not assignable to type 'S'. + 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,35): error TS2322: Type 'T' is not assignable to type 'S'. + 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type '""' is not assignable to type 'number'. @@ -15,12 +17,14 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete (new Chain(t)).then(tt => s).then(ss => t); ~ !!! error TS2322: Type 'T' is not assignable to type 'S'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. !!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:3:27: The expected type comes from the return type of this signature. // But error to try to climb up the chain (new Chain(s)).then(ss => t); ~ !!! error TS2322: Type 'T' is not assignable to type 'S'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. !!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:3:27: The expected type comes from the return type of this signature. // Staying at T or S should be fine diff --git a/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt b/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt index 32e8464a19573..3e5d8774007a5 100644 --- a/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt +++ b/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(6,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(12,9): error TS2322: Type 'T2' is not assignable to type 'T1'. + 'T2' is assignable to the constraint of type '{}', but 'T1' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts (2 errors) ==== @@ -19,4 +20,5 @@ tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOpera var result: T1 = (x, y); //error here ~~~~~~ !!! error TS2322: Type 'T2' is not assignable to type 'T1'. +!!! error TS2322: 'T2' is assignable to the constraint of type '{}', but 'T1' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/complexRecursiveCollections.errors.txt b/tests/baselines/reference/complexRecursiveCollections.errors.txt index aaed4f2636092..ea96208f770b0 100644 --- a/tests/baselines/reference/complexRecursiveCollections.errors.txt +++ b/tests/baselines/reference/complexRecursiveCollections.errors.txt @@ -2,14 +2,17 @@ tests/cases/compiler/immutable.ts(341,22): error TS2430: Interface 'Keyed' Types of property 'toSeq' are incompatible. Type '() => Keyed' is not assignable to type '() => this'. Type 'Keyed' is not assignable to type 'this'. + 'Keyed' is assignable to the constraint of type 'Keyed', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. tests/cases/compiler/immutable.ts(359,22): error TS2430: Interface 'Indexed' incorrectly extends interface 'Collection'. Types of property 'toSeq' are incompatible. Type '() => Indexed' is not assignable to type '() => this'. Type 'Indexed' is not assignable to type 'this'. + 'Indexed' is assignable to the constraint of type 'Indexed', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends interface 'Collection'. Types of property 'toSeq' are incompatible. Type '() => Set' is not assignable to type '() => this'. Type 'Set' is not assignable to type 'this'. + 'Set' is assignable to the constraint of type 'Set', but 'this' could be instantiated with a different subtype of constraint 'Set'. ==== tests/cases/compiler/complex.ts (0 errors) ==== @@ -380,6 +383,7 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco !!! error TS2430: Types of property 'toSeq' are incompatible. !!! error TS2430: Type '() => Keyed' is not assignable to type '() => this'. !!! error TS2430: Type 'Keyed' is not assignable to type 'this'. +!!! error TS2430: 'Keyed' is assignable to the constraint of type 'Keyed', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. toJS(): Object; toJSON(): { [key: string]: V }; toSeq(): Seq.Keyed; @@ -403,6 +407,7 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco !!! error TS2430: Types of property 'toSeq' are incompatible. !!! error TS2430: Type '() => Indexed' is not assignable to type '() => this'. !!! error TS2430: Type 'Indexed' is not assignable to type 'this'. +!!! error TS2430: 'Indexed' is assignable to the constraint of type 'Indexed', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. toJS(): Array; toJSON(): Array; // Reading values @@ -440,6 +445,7 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco !!! error TS2430: Types of property 'toSeq' are incompatible. !!! error TS2430: Type '() => Set' is not assignable to type '() => this'. !!! error TS2430: Type 'Set' is not assignable to type 'this'. +!!! error TS2430: 'Set' is assignable to the constraint of type 'Set', but 'this' could be instantiated with a different subtype of constraint 'Set'. toJS(): Array; toJSON(): Array; toSeq(): Seq.Set; diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index 62239eca7b821..41cf05c05871e 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -14,7 +14,9 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(30,9): error TS23 Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'Pick' is not assignable to type 'T'. + 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick' is not assignable to type 'T'. + 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. @@ -36,10 +38,14 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(135,5): error TS2 tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a read-only property. tests/cases/conformance/types/conditional/conditionalTypes1.ts(137,10): error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2322: Type 'ZeroOf' is not assignable to type 'T'. - Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. - Type '0' is not assignable to type 'T'. - Type '"" | 0' is not assignable to type 'T'. - Type '""' is not assignable to type 'T'. + 'ZeroOf' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. + Type '0' is not assignable to type 'T'. + '0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + Type '"" | 0' is not assignable to type 'T'. + '"" | 0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + Type '""' is not assignable to type 'T'. + '""' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. Type 'string' is not assignable to type 'ZeroOf'. @@ -175,9 +181,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS x = y; // Error ~ !!! error TS2322: Type 'Pick' is not assignable to type 'T'. +!!! error TS2322: 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. x = z; // Error ~ !!! error TS2322: Type 'Pick' is not assignable to type 'T'. +!!! error TS2322: 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; y = z; // Error ~ @@ -265,10 +273,14 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS x = y; // Error ~ !!! error TS2322: Type 'ZeroOf' is not assignable to type 'T'. -!!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. -!!! error TS2322: Type '0' is not assignable to type 'T'. -!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. -!!! error TS2322: Type '""' is not assignable to type 'T'. +!!! error TS2322: 'ZeroOf' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. +!!! error TS2322: Type '0' is not assignable to type 'T'. +!!! error TS2322: '0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: Type '"" | 0' is not assignable to type 'T'. +!!! error TS2322: '"" | 0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: Type '""' is not assignable to type 'T'. +!!! error TS2322: '""' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. y = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'ZeroOf'. diff --git a/tests/baselines/reference/conditionalTypes2.errors.txt b/tests/baselines/reference/conditionalTypes2.errors.txt index a1a23b6da1870..a93f631aaac19 100644 --- a/tests/baselines/reference/conditionalTypes2.errors.txt +++ b/tests/baselines/reference/conditionalTypes2.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(15,5): error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. Type 'A' is not assignable to type 'B'. + 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(19,5): error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. Type 'A' is not assignable to type 'B'. + 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(24,5): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. Types of property 'foo' are incompatible. Type 'B extends string ? keyof B : B' is not assignable to type 'A extends string ? keyof A : A'. @@ -12,6 +14,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(25,5): error TS23 Types of property 'foo' are incompatible. Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'. Type 'A' is not assignable to type 'B'. + 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(73,12): error TS2345: Argument of type 'Extract, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'. Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'. Type 'Extract' is not assignable to type '{ foo: string; bat: string; }'. @@ -42,6 +45,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 ~ !!! error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. !!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. } function f2(a: Contravariant, b: Contravariant) { @@ -49,6 +53,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 ~ !!! error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. !!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. b = a; } @@ -67,6 +72,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'. !!! error TS2322: Type 'A' is not assignable to type 'B'. +!!! error TS2322: 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. } // Extract is a T that is known to be a Function diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt index cc2c1e871e5ed..565c9fbf1b942 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt @@ -6,6 +6,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Types of property 'a2' are incompatible. Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts (2 errors) ==== @@ -86,6 +87,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: new (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt index 1a9edc159af19..e65e974b4fac7 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt @@ -3,6 +3,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(50,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. @@ -30,6 +31,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(95,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'. Types of property 'a2' are incompatible. Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. @@ -85,6 +87,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'number' is not assignable to type 'T'. +!!! error TS2430: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -161,6 +164,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => string[]; // error } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt index 6245fead91964..c87f14b12bc66 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt @@ -3,27 +3,32 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(28,11): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(32,11): error TS2430: Interface 'I3' incorrectly extends interface 'A'. Types of property 'a3' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(36,11): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a4' are incompatible. Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(40,11): error TS2430: Interface 'I5' incorrectly extends interface 'A'. Types of property 'a5' are incompatible. Type 'new (x: (arg: T) => U) => T' is not assignable to type 'new (x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(44,11): error TS2430: Interface 'I7' incorrectly extends interface 'A'. Types of property 'a11' are incompatible. Type 'new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base' is not assignable to type 'new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base'. @@ -31,6 +36,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'foo' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(48,11): error TS2430: Interface 'I9' incorrectly extends interface 'A'. Types of property 'a16' are incompatible. Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: T; b: T; }) => T[]'. @@ -38,7 +44,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'a' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - Type 'Base' is not assignable to type 'T'. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts (7 errors) ==== @@ -72,6 +80,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new (x: T) => T[]; } @@ -82,6 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => string[]; } @@ -92,6 +102,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x: T) => T; } @@ -102,6 +113,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T, y: U) => string; } @@ -113,6 +125,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: (arg: T) => U) => T; } @@ -125,6 +138,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'foo' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; } @@ -137,6 +151,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: Type 'Base' is not assignable to type 'T'. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: Type 'Base' is not assignable to type 'T'. +!!! error TS2430: 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a16: new (x: { a: T; b: T }) => T[]; } \ No newline at end of file diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index 9cad967dd7727..3a24a78553e7d 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type '1' is not assignable to type 'string'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2322: Type 'Date' is not assignable to type 'T'. + 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. ==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts (4 errors) ==== @@ -19,8 +22,10 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'T'. +!!! error TS2322: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ~~~~~~~~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. var z = x; } } @@ -30,6 +35,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T = new Date()) { // error ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'Date' is not assignable to type 'T'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. var y = x; } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index 6d3644eabb035..f142045702434 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -2,6 +2,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,18): error TS2322: Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts (4 errors) ==== @@ -39,6 +40,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. ~ !!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! related TS6500 tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts:24:5: The expected type comes from property 'x' which is declared here on type 'F' } } diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index 359fab212e909..d45d816876b72 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -3,7 +3,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type '""' is not assignable to type 'T'. + '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type '""' is not assignable to type 'T'. + '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'number'. @@ -50,10 +52,12 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'T'. +!!! error TS2322: '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. foo(): T { return ''; // error ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'T'. +!!! error TS2322: '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. } } diff --git a/tests/baselines/reference/enumAssignability.errors.txt b/tests/baselines/reference/enumAssignability.errors.txt index bfabb5eae8819..01045b53aa006 100644 --- a/tests/baselines/reference/enumAssignability.errors.txt +++ b/tests/baselines/reference/enumAssignability.errors.txt @@ -14,10 +14,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(43,9): error TS2322: Type 'E' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(45,9): error TS2322: Type 'E' is not assignable to type 'String'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(48,9): error TS2322: Type 'E' is not assignable to type 'T'. + 'E' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(49,9): error TS2322: Type 'E' is not assignable to type 'U'. + 'E' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(50,9): error TS2322: Type 'E' is not assignable to type 'V'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(51,13): error TS2322: Type 'E' is not assignable to type 'A'. + 'E' is assignable to the constraint of type 'Number', but 'A' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(52,13): error TS2322: Type 'E' is not assignable to type 'B'. + 'E' is assignable to the constraint of type 'E', but 'B' could be instantiated with a different subtype of constraint 'E'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts (20 errors) ==== @@ -101,17 +105,21 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi x = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'T'. +!!! error TS2322: 'E' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'U'. +!!! error TS2322: 'E' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. z = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'V'. var a: A = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'A'. +!!! error TS2322: 'E' is assignable to the constraint of type 'Number', but 'A' could be instantiated with a different subtype of constraint 'Number'. var b: B = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'B'. +!!! error TS2322: 'E' is assignable to the constraint of type 'E', but 'B' could be instantiated with a different subtype of constraint 'E'. } } \ No newline at end of file diff --git a/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt b/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt index e2b18aa2fc35a..6727be14e02ed 100644 --- a/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt +++ b/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(2,5): error TS2322: Type '{ a: string; b: number; c: number; }' is not assignable to type 'T'. tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(6,5): error TS2322: Type '{ a: number; }' is not assignable to type 'T'. tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(10,5): error TS2322: Type '{ a: string; }' is not assignable to type 'T'. + '{ a: string; }' is assignable to the constraint of type '{ a: string; }', but 'T' could be instantiated with a different subtype of constraint '{ a: string; }'. ==== tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts (3 errors) ==== @@ -20,5 +21,6 @@ tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(10,5 x = { a: "not ok" }; ~ !!! error TS2322: Type '{ a: string; }' is not assignable to type 'T'. +!!! error TS2322: '{ a: string; }' is assignable to the constraint of type '{ a: string; }', but 'T' could be instantiated with a different subtype of constraint '{ a: string; }'. } \ No newline at end of file diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt b/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt index e37ff82aa7b54..5d9188fe5c721 100644 --- a/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt +++ b/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt @@ -1,6 +1,9 @@ tests/cases/compiler/errorMessagesIntersectionTypes03.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'T'. + 'A & B' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'U'. + 'A & B' is assignable to the constraint of type 'A', but 'U' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'V'. + 'A & B' is assignable to the constraint of type 'A', but 'V' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(22,5): error TS2322: Type 'T & B' is not assignable to type 'U'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(23,5): error TS2322: Type 'T & B' is not assignable to type 'V'. @@ -25,12 +28,15 @@ tests/cases/compiler/errorMessagesIntersectionTypes03.ts(23,5): error TS2322: Ty t = a_and_b; ~ !!! error TS2322: Type 'A & B' is not assignable to type 'T'. +!!! error TS2322: 'A & B' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. u = a_and_b; ~ !!! error TS2322: Type 'A & B' is not assignable to type 'U'. +!!! error TS2322: 'A & B' is assignable to the constraint of type 'A', but 'U' could be instantiated with a different subtype of constraint 'A'. v = a_and_b; ~ !!! error TS2322: Type 'A & B' is not assignable to type 'V'. +!!! error TS2322: 'A & B' is assignable to the constraint of type 'A', but 'V' could be instantiated with a different subtype of constraint 'A'. t = t_and_b; u = t_and_b; diff --git a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt index def0ff8811e71..06d9eb0778a32 100644 --- a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt +++ b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts(9,1): error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. Type '{}[]' is not assignable to type 'T'. + '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts (1 errors) ==== @@ -15,6 +16,7 @@ tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts(9,1): error TS2322: ~ !!! error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. !!! error TS2322: Type '{}[]' is not assignable to type 'T'. +!!! error TS2322: '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var s = f("str").toUpperCase(); console.log(s); diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index ca3e195a8a762..ef3fceb4ce434 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -3,12 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -51,6 +54,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r10 = foo2(1, (x) => ''); // string var r11 = foo3(1, (x: T) => '', ''); // error @@ -58,11 +62,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index a66672f515131..eb382ecc63218 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -2,12 +2,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. + 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,43): error TS2322: Type 'F' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. + 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. @@ -38,6 +40,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r9 = r7(new Date()); // should be ok ~~~~~~~~~~ !!! error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. +!!! error TS2345: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); // error ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. @@ -84,6 +87,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r9 = r7(new Date()); ~~~~~~~~~~ !!! error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. +!!! error TS2345: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt index 08b5dbc177136..b9fe141b174d7 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt @@ -1,6 +1,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(19,17): error TS2345: Argument of type 'C' is not assignable to parameter of type 'D'. Property 'y' is missing in type 'C' but required in type 'D'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(30,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. + 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts (2 errors) ==== @@ -40,6 +41,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r5 = foo(c, d); // error ~ !!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. +!!! error TS2345: 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt index 0fd0f98209aa9..63276780a1959 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt @@ -3,6 +3,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(19,23): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. Type 'void' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(22,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. + 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts (3 errors) ==== @@ -37,5 +38,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r5 = foo(c, d); // error ~ !!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. +!!! error TS2345: 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index b65b21e127b43..39a65dab4e535 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,7 +1,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type 'Number', but 'T' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'. - Type 'T' is not assignable to type 'V'. + 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + Type 'T' is not assignable to type 'V'. + 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts (3 errors) ==== @@ -12,12 +16,16 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC function foo3(x: T = 1) { } // error ~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'T'. +!!! error TS2322: '1' is assignable to the constraint of type 'Number', but 'T' could be instantiated with a different subtype of constraint 'Number'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. function foo5(x: U, y: T = x) { } // ok function foo6(x: T, y: U, z: V = y) { } // error ~~~~~~~~ !!! error TS2322: Type 'U' is not assignable to type 'V'. -!!! error TS2322: Type 'T' is not assignable to type 'V'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'T' is not assignable to type 'V'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. function foo7(x: V, y: U = x) { } // should be ok \ No newline at end of file diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index ff4c2235b4925..6c50f01c9ebae 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,9 +1,11 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(12,17): error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(13,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17): error TS2558: Expected 0 type arguments, but got 1. @@ -16,6 +18,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 var r2 = f(1); ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. @@ -33,6 +36,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 var r12 = f(y); ~ !!! error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'. +!!! error TS2345: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r22 = f(y); ~~~~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index c44a1e155ac54..2c4050df69d7c 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,12 +1,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -73,6 +76,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r10 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error @@ -80,11 +84,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index e1dca77d958d0..e7dcfd83dea7a 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -3,6 +3,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(4,59): error TS2344: Type 'T' does Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericDefaultsErrors.ts(5,44): error TS2344: Type 'T' does not satisfy the constraint 'number'. tests/cases/compiler/genericDefaultsErrors.ts(6,39): error TS2344: Type 'number' does not satisfy the constraint 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericDefaultsErrors.ts(10,5): error TS2558: Expected 2-3 type arguments, but got 1. tests/cases/compiler/genericDefaultsErrors.ts(13,5): error TS2558: Expected 2-3 type arguments, but got 4. tests/cases/compiler/genericDefaultsErrors.ts(17,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. @@ -16,6 +17,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(27,52): error TS2344: Type 'T' doe Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericDefaultsErrors.ts(28,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. tests/cases/compiler/genericDefaultsErrors.ts(29,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericDefaultsErrors.ts(32,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(33,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(36,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. @@ -40,6 +42,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,29): error TS2716: Type paramet declare function f06(): void; // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'T'. +!!! error TS2344: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. declare function f11(): void; f11(); // ok @@ -88,6 +91,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,29): error TS2716: Type paramet interface i08 { } // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'T'. +!!! error TS2344: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. interface i09 { } type i09t00 = i09; // error diff --git a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt index c84308189838f..870fea3e2dd56 100644 --- a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt +++ b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts(6,1): error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. Type '{}[]' is not assignable to type 'T'. + '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts (1 errors) ==== @@ -12,6 +13,7 @@ tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts(6,1): err ~ !!! error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. !!! error TS2322: Type '{}[]' is not assignable to type 'T'. +!!! error TS2322: '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var s = f("str").toUpperCase(); diff --git a/tests/baselines/reference/genericRestParameters1.errors.txt b/tests/baselines/reference/genericRestParameters1.errors.txt index d0a09ee46387a..735d3cdf9e357 100644 --- a/tests/baselines/reference/genericRestParameters1.errors.txt +++ b/tests/baselines/reference/genericRestParameters1.errors.txt @@ -3,9 +3,11 @@ tests/cases/conformance/types/rest/genericRestParameters1.ts(31,1): error TS2556 tests/cases/conformance/types/rest/genericRestParameters1.ts(133,40): error TS2344: Type '(...args: T) => void' does not satisfy the constraint '(...args: any[]) => any'. Types of parameters 'args' and 'args' are incompatible. Type 'any[]' is not assignable to type 'T'. + 'any[]' is assignable to the constraint of type 'any[]', but 'T' could be instantiated with a different subtype of constraint 'any[]'. tests/cases/conformance/types/rest/genericRestParameters1.ts(134,51): error TS2344: Type 'new (...args: T) => void' does not satisfy the constraint 'new (...args: any[]) => any'. Types of parameters 'args' and 'args' are incompatible. Type 'any[]' is not assignable to type 'T'. + 'any[]' is assignable to the constraint of type 'any[]', but 'T' could be instantiated with a different subtype of constraint 'any[]'. tests/cases/conformance/types/rest/genericRestParameters1.ts(135,23): error TS2344: Type 'Function' does not satisfy the constraint '(...args: any[]) => any'. Type 'Function' provides no match for the signature '(...args: any[]): any'. tests/cases/conformance/types/rest/genericRestParameters1.ts(164,1): error TS2322: Type '(a: never) => void' is not assignable to type '(...args: any[]) => void'. @@ -156,11 +158,13 @@ tests/cases/conformance/types/rest/genericRestParameters1.ts(164,1): error TS232 !!! error TS2344: Type '(...args: T) => void' does not satisfy the constraint '(...args: any[]) => any'. !!! error TS2344: Types of parameters 'args' and 'args' are incompatible. !!! error TS2344: Type 'any[]' is not assignable to type 'T'. +!!! error TS2344: 'any[]' is assignable to the constraint of type 'any[]', but 'T' could be instantiated with a different subtype of constraint 'any[]'. type T08 = ConstructorParameters void>; ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2344: Type 'new (...args: T) => void' does not satisfy the constraint 'new (...args: any[]) => any'. !!! error TS2344: Types of parameters 'args' and 'args' are incompatible. !!! error TS2344: Type 'any[]' is not assignable to type 'T'. +!!! error TS2344: 'any[]' is assignable to the constraint of type 'any[]', but 'T' could be instantiated with a different subtype of constraint 'any[]'. type T09 = Parameters; ~~~~~~~~ !!! error TS2344: Type 'Function' does not satisfy the constraint '(...args: any[]) => any'. diff --git a/tests/baselines/reference/genericTypeAssertions4.errors.txt b/tests/baselines/reference/genericTypeAssertions4.errors.txt index 4c23bd6d4585b..45bb38616cec1 100644 --- a/tests/baselines/reference/genericTypeAssertions4.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions4.errors.txt @@ -1,8 +1,13 @@ tests/cases/compiler/genericTypeAssertions4.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. + 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. + 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. + 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(23,9): error TS2352: Conversion of type 'B' 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. + 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Conversion of type 'C' 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. + 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. ==== tests/cases/compiler/genericTypeAssertions4.ts (5 errors) ==== @@ -27,17 +32,22 @@ tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Conversion o y = a; // error: cannot convert A to T ~ !!! error TS2322: Type 'A' is not assignable to type 'T'. +!!! error TS2322: 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = b; // error: cannot convert B to T ~ !!! error TS2322: Type 'B' is not assignable to type 'T'. +!!! error TS2322: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~ !!! error TS2322: Type 'C' is not assignable to type 'T'. +!!! error TS2322: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = a; y = b; // error: cannot convert B to T ~~~~ !!! error TS2352: Conversion of type 'B' 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: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~~~~ !!! error TS2352: Conversion of type 'C' 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: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions5.errors.txt b/tests/baselines/reference/genericTypeAssertions5.errors.txt index e01b90d72a5f8..43ac1ac942b0e 100644 --- a/tests/baselines/reference/genericTypeAssertions5.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions5.errors.txt @@ -1,8 +1,13 @@ tests/cases/compiler/genericTypeAssertions5.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. + 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. + 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. + 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(23,9): error TS2352: Conversion of type 'B' 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. + 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Conversion of type 'C' 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. + 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. ==== tests/cases/compiler/genericTypeAssertions5.ts (5 errors) ==== @@ -27,17 +32,22 @@ tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Conversion o y = a; // error: cannot convert A to T ~ !!! error TS2322: Type 'A' is not assignable to type 'T'. +!!! error TS2322: 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = b; // error: cannot convert B to T ~ !!! error TS2322: Type 'B' is not assignable to type 'T'. +!!! error TS2322: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~ !!! error TS2322: Type 'C' is not assignable to type 'T'. +!!! error TS2322: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = a; y = b; // error: cannot convert B to T ~~~~ !!! error TS2352: Conversion of type 'B' 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: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~~~~ !!! error TS2352: Conversion of type 'C' 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: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions6.errors.txt b/tests/baselines/reference/genericTypeAssertions6.errors.txt index ef65803a47d98..624f1ef62cbc9 100644 --- a/tests/baselines/reference/genericTypeAssertions6.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions6.errors.txt @@ -1,7 +1,11 @@ tests/cases/compiler/genericTypeAssertions6.ts(8,13): 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 '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Conversion of type 'T' to type 'U' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. 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. - Type 'Date' is not comparable to type 'T'. + 'U' is assignable to the constraint of type 'Date', 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. ==== tests/cases/compiler/genericTypeAssertions6.ts (3 errors) ==== @@ -15,9 +19,11 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Conversion x = y; ~~~~ !!! 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 '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; ~~~~ !!! error TS2352: Conversion of type 'T' to type 'U' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +!!! error TS2352: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } } @@ -30,7 +36,9 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Conversion var e = new Date(); ~~~~~~~~~~~~~~~~ !!! 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: Type 'Date' is not comparable to type 'T'. +!!! error TS2352: 'U' is assignable to the constraint of type 'Date', 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. } } diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index 6a243650b1eab..5b9daadc9716e 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1. @@ -13,6 +14,7 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe var f = (x: B) => { return x.foo(1); } // error ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var f2 = (x: B) => { return x.foo(1); } // error ~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt index c9fae8cc89c4a..bf3703fa787be 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt @@ -4,6 +4,7 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (5 errors) ==== @@ -27,6 +28,7 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } } diff --git a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt index 576013f43c535..0cecab1f92fe7 100644 --- a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt +++ b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt @@ -5,6 +5,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(8,5): error TS2416: tests/cases/compiler/implementGenericWithMismatchedTypes.ts(17,5): error TS2416: Property 'foo' in type 'C2' is not assignable to the same property in base type 'IFoo2'. Type '(x: Tstring) => number' is not assignable to type '(x: T) => T'. Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/implementGenericWithMismatchedTypes.ts (2 errors) ==== @@ -34,6 +35,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(17,5): error TS2416: !!! error TS2416: Property 'foo' in type 'C2' is not assignable to the same property in base type 'IFoo2'. !!! error TS2416: Type '(x: Tstring) => number' is not assignable to type '(x: T) => T'. !!! error TS2416: Type 'number' is not assignable to type 'T'. +!!! error TS2416: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. return null; } } \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt b/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt index e36eaf21311f7..2a7a2f9638101 100644 --- a/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt +++ b/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/incompatibleAssignmentOfIdenticallyNamedTypes.ts(6,9): error TS2719: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/incompatibleAssignmentOfIdenticallyNamedTypes.ts (1 errors) ==== @@ -10,6 +11,7 @@ tests/cases/compiler/incompatibleAssignmentOfIdenticallyNamedTypes.ts(6,9): erro this.x = a; ~~~~~~ !!! error TS2719: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2719: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureAndMappedType.errors.txt b/tests/baselines/reference/indexSignatureAndMappedType.errors.txt index 623fcd11bd050..c40293f428074 100644 --- a/tests/baselines/reference/indexSignatureAndMappedType.errors.txt +++ b/tests/baselines/reference/indexSignatureAndMappedType.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/indexSignatureAndMappedType.ts(6,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. tests/cases/compiler/indexSignatureAndMappedType.ts(15,5): error TS2322: Type 'Record' is not assignable to type '{ [key: string]: T; }'. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/indexSignatureAndMappedType.ts(16,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. @@ -25,6 +26,7 @@ tests/cases/compiler/indexSignatureAndMappedType.ts(16,5): error TS2322: Type '{ ~ !!! error TS2322: Type 'Record' is not assignable to type '{ [key: string]: T; }'. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Error ~ !!! error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. diff --git a/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt b/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt index c8367bef57bd1..a714814fa9ca7 100644 --- a/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt +++ b/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt @@ -4,6 +4,7 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansion tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts(21,5): error TS2322: Type 'OwnerList' is not assignable to type 'List'. Types of property 'data' are incompatible. Type 'List' is not assignable to type 'T'. + 'List' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts (2 errors) ==== @@ -36,6 +37,7 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansion !!! error TS2322: Type 'OwnerList' is not assignable to type 'List'. !!! error TS2322: Types of property 'data' are incompatible. !!! error TS2322: Type 'List' is not assignable to type 'T'. +!!! error TS2322: 'List' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/intersectionTypeInference.errors.txt b/tests/baselines/reference/intersectionTypeInference.errors.txt index af0b1b447bcaf..cdfa299042895 100644 --- a/tests/baselines/reference/intersectionTypeInference.errors.txt +++ b/tests/baselines/reference/intersectionTypeInference.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/types/intersection/intersectionTypeInference.ts(5,5): error TS2322: Type 'T' is not assignable to type 'T & U'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/intersection/intersectionTypeInference.ts(6,5): error TS2322: Type 'U' is not assignable to type 'T & U'. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/intersection/intersectionTypeInference.ts (2 errors) ==== @@ -13,10 +15,12 @@ tests/cases/conformance/types/intersection/intersectionTypeInference.ts(6,5): er ~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'T & U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. result = obj2; // Error ~~~~~~ !!! error TS2322: Type 'U' is not assignable to type 'T & U'. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. return result; } diff --git a/tests/baselines/reference/invalidBooleanAssignments.errors.txt b/tests/baselines/reference/invalidBooleanAssignments.errors.txt index 06ec14b4dd6eb..6265f2b70a9e2 100644 --- a/tests/baselines/reference/invalidBooleanAssignments.errors.txt +++ b/tests/baselines/reference/invalidBooleanAssignments.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(15 tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(17,5): error TS2322: Type 'true' is not assignable to type '() => string'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(21,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(24,5): error TS2322: Type 'boolean' is not assignable to type 'T'. + 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26,1): error TS2539: Cannot assign to 'i' because it is not a variable. @@ -53,6 +54,7 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26 a = x; ~ !!! error TS2322: Type 'boolean' is not assignable to type 'T'. +!!! error TS2322: 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } i = x; ~ diff --git a/tests/baselines/reference/invalidNumberAssignments.errors.txt b/tests/baselines/reference/invalidNumberAssignments.errors.txt index 102376f1c501e..03e27b5c480ad 100644 --- a/tests/baselines/reference/invalidNumberAssignments.errors.txt +++ b/tests/baselines/reference/invalidNumberAssignments.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(14,5 tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(15,5): error TS2322: Type '1' is not assignable to type '{ 0: number; }'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(18,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(21,5): error TS2322: Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1): error TS2539: Cannot assign to 'i' because it is not a variable. @@ -50,6 +51,7 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1 a = x; ~ !!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } i = x; ~ diff --git a/tests/baselines/reference/invalidStringAssignments.errors.txt b/tests/baselines/reference/invalidStringAssignments.errors.txt index 728ce09e6b41e..8502ab913205b 100644 --- a/tests/baselines/reference/invalidStringAssignments.errors.txt +++ b/tests/baselines/reference/invalidStringAssignments.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(14,5 tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(15,5): error TS2322: Type '1' is not assignable to type '{ 0: number; }'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(18,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(23,1): error TS2539: Cannot assign to 'i' because it is not a variable. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(26,5): error TS2322: Type 'string' is not assignable to type 'E'. @@ -51,6 +52,7 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(26,5 a = x; ~ !!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } i = x; ~ diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index b0eaac39c6d21..0c0e1d199cac8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -44,23 +44,36 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(87,5): error Type 'keyof T' is not assignable to type 'keyof T & keyof U'. Type 'keyof T' is not assignable to type 'keyof U'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(103,9): error TS2322: Type 'Extract' is not assignable to type 'K'. - Type 'string & keyof T' is not assignable to type 'K'. - Type 'string' is not assignable to type 'K'. - Type 'string' is not assignable to type 'K'. + 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + Type 'string & keyof T' is not assignable to type 'K'. + 'string & keyof T' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + Type 'string' is not assignable to type 'K'. + 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + Type 'string' is not assignable to type 'K'. + 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(105,9): error TS2322: Type 'T[Extract]' is not assignable to type 'T[K]'. Type 'Extract' is not assignable to type 'K'. + 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(108,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(111,5): error TS2322: Type 'T[J]' is not assignable to type 'U[J]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. 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'. - Type 'Extract' is not assignable to type 'J'. - Type 'string & keyof T' is not assignable to type 'J'. - Type 'string' is not assignable to type 'J'. - Type 'string' is not assignable to type 'J'. + 'K' is assignable to the constraint of type 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. + Type 'Extract' is not assignable to type 'J'. + 'Extract' is assignable to the constraint of type 'string', 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 'string', 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 'string', 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 'string', 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'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type '42' is not assignable to type 'keyof T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type '"hello"' is not assignable to type 'keyof T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'. @@ -249,42 +262,55 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error k = key // error, keyof T =/=> K ~ !!! error TS2322: Type 'Extract' is not assignable to type 'K'. -!!! error TS2322: Type 'string & keyof T' is not assignable to type 'K'. -!!! error TS2322: Type 'string' is not assignable to type 'K'. -!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: Type 'string & keyof T' is not assignable to type 'K'. +!!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. t[key] = tk; // ok, T[K] ==> T[keyof T] tk = t[key]; // error, T[keyof T] =/=> T[K] ~~ !!! error TS2322: Type 'T[Extract]' is not assignable to type 'T[K]'. !!! error TS2322: Type 'Extract' is not assignable to type 'K'. +!!! error TS2322: 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. } tk = uk; uk = tk; // error ~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tj = uj; uj = tj; // error ~~ !!! error TS2322: Type 'T[J]' is not assignable to type 'U[J]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tk = tj; tj = tk; // 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: Type 'Extract' is not assignable to type 'J'. -!!! error TS2322: Type 'string & keyof T' is not assignable to type 'J'. -!!! error TS2322: Type 'string' is not assignable to type 'J'. -!!! error TS2322: Type 'string' is not assignable to type 'J'. +!!! error TS2322: 'K' is assignable to the constraint of type 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: Type 'Extract' is not assignable to type 'J'. +!!! error TS2322: 'Extract' is assignable to the constraint of type 'string', 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 'string', 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 'string', 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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. tk = uj; uj = tk; // error ~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[J]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } // The constraint of 'keyof T' is 'keyof T' diff --git a/tests/baselines/reference/mappedTypeRelationships.errors.txt b/tests/baselines/reference/mappedTypeRelationships.errors.txt index 60a06e000c255..4f4c5050095d6 100644 --- a/tests/baselines/reference/mappedTypeRelationships.errors.txt +++ b/tests/baselines/reference/mappedTypeRelationships.errors.txt @@ -1,14 +1,18 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(11,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(16,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(20,5): error TS2536: Type 'keyof U' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,5): error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,12): error TS2536: Type 'keyof U' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(25,5): error TS2536: Type 'K' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,12): error TS2536: Type 'K' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(30,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'T[keyof T]'. Type 'undefined' is not assignable to type 'T[keyof T]'. @@ -19,45 +23,61 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(40,5): error TS2 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(41,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'. Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(45,5): error TS2322: Type 'U[K] | undefined' is not assignable to type 'T[K]'. Type 'undefined' is not assignable to type 'T[K]'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(46,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'. Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(51,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(56,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(72,5): error TS2322: Type 'Partial' is not assignable to type 'T'. + 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(78,5): error TS2322: Type 'Partial' is not assignable to type 'Partial'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(88,5): error TS2322: Type 'Readonly' is not assignable to type 'Readonly'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(127,5): error TS2322: Type 'Partial' is not assignable to type 'Identity'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(143,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. Type 'T[P]' is not assignable to type 'U[P]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(148,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. Type 'keyof U' is not assignable to type 'keyof T'. Type 'string | number | symbol' is not assignable to type 'keyof T'. Type 'string' is not assignable to type 'keyof T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(153,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'. Type 'keyof T' is not assignable to type 'K'. - Type 'string | number | symbol' is not assignable to type 'K'. - Type 'string' is not assignable to type 'K'. + 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + Type 'string | number | symbol' is not assignable to type 'K'. + 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + Type 'string' is not assignable to type 'K'. + 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(158,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. Type 'keyof U' is not assignable to type 'K'. - Type 'string | number | symbol' is not assignable to type 'K'. - Type 'string' is not assignable to type 'K'. + 'keyof U' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + Type 'string | number | symbol' is not assignable to type 'K'. + 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + Type 'string' is not assignable to type 'K'. + 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(163,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. Type 'keyof T' is not assignable to type 'K'. - Type 'string | number | symbol' is not assignable to type 'K'. - Type 'string' is not assignable to type 'K'. + 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + Type 'string | number | symbol' is not assignable to type 'K'. + 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + Type 'string' is not assignable to type 'K'. + 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'. Type 'T[P]' is not assignable to type 'U[P]'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (30 errors) ==== @@ -75,6 +95,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f4(x: T, y: U, k: K) { @@ -83,6 +104,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f5(x: T, y: U, k: keyof U) { @@ -93,6 +115,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2536: Type 'keyof U' cannot be used to index type 'T'. } @@ -105,6 +128,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2536: Type 'K' cannot be used to index type 'T'. } @@ -135,6 +159,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'. !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f13(x: T, y: Partial, k: K) { @@ -147,6 +172,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'. !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f20(x: T, y: Readonly, k: keyof T) { @@ -169,6 +195,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2542: Index signature in type 'Readonly' only permits reading. } @@ -179,6 +206,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2542: Index signature in type 'Readonly' only permits reading. } @@ -189,6 +217,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS x = y; // Error ~ !!! error TS2322: Type 'Partial' is not assignable to type 'T'. +!!! error TS2322: 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; } @@ -270,6 +299,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. !!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f72(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) { @@ -288,8 +318,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~ !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'. !!! error TS2322: Type 'keyof T' is not assignable to type 'K'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. -!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. +!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. } function f74(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) { @@ -298,8 +331,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~ !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. !!! error TS2322: Type 'keyof U' is not assignable to type 'K'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. -!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'keyof U' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. +!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. } function f75(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) { @@ -308,8 +344,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~ !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. !!! error TS2322: Type 'keyof T' is not assignable to type 'K'. -!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. -!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. +!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: Type 'string' is not assignable to type 'K'. +!!! error TS2322: 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. } function f76(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) { @@ -319,6 +358,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'. !!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f80(t: T): Partial { diff --git a/tests/baselines/reference/mappedTypes6.errors.txt b/tests/baselines/reference/mappedTypes6.errors.txt index cbe4c58d27e3c..834f0826c7fb3 100644 --- a/tests/baselines/reference/mappedTypes6.errors.txt +++ b/tests/baselines/reference/mappedTypes6.errors.txt @@ -1,6 +1,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(23,5): error TS2322: Type 'T' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(24,5): error TS2322: Type 'Partial' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(27,5): error TS2322: Type 'Partial' is not assignable to type 'T'. + 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypes6.ts(37,5): error TS2322: Type 'Required' is not assignable to type 'Denullified'. Type 'T[P]' is not assignable to type 'NonNullable'. tests/cases/conformance/types/mapped/mappedTypes6.ts(38,5): error TS2322: Type 'T' is not assignable to type 'Denullified'. @@ -8,9 +9,11 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(39,5): error TS2322: Type ' tests/cases/conformance/types/mapped/mappedTypes6.ts(42,5): error TS2322: Type 'T' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(43,5): error TS2322: Type 'Partial' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(47,5): error TS2322: Type 'Partial' is not assignable to type 'T'. + 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypes6.ts(56,5): error TS2322: Type '{}' is not assignable to type 'Denullified'. tests/cases/conformance/types/mapped/mappedTypes6.ts(57,5): error TS2322: Type '{}' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(58,5): error TS2322: Type '{}' is not assignable to type 'T'. + '{}' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypes6.ts(92,1): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type 'Foo'. tests/cases/conformance/types/mapped/mappedTypes6.ts(104,1): error TS2739: Type '{ a: number; }' is missing the following properties from type 'Required': b, c, d tests/cases/conformance/types/mapped/mappedTypes6.ts(105,1): error TS2739: Type '{ a: number; b: number; }' is missing the following properties from type 'Required': c, d @@ -54,6 +57,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno y = z; // Error ~ !!! error TS2322: Type 'Partial' is not assignable to type 'T'. +!!! error TS2322: 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. z = x; z = y; z = z; @@ -87,6 +91,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno y = z; // Error ~ !!! error TS2322: Type 'Partial' is not assignable to type 'T'. +!!! error TS2322: 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. z = w; z = x; z = y; @@ -104,6 +109,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno y = {}; // Error ~ !!! error TS2322: Type '{}' is not assignable to type 'T'. +!!! error TS2322: '{}' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. z = {}; } diff --git a/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt b/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt index 83ce98f1cd625..f84ef93e314ed 100644 --- a/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt +++ b/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt @@ -1,6 +1,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(10,9): error TS2322: Type 'T' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(11,9): error TS2322: Type 'T' is not assignable to type 'object | U'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts (2 errors) ==== @@ -20,5 +21,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(11,9) ~ !!! error TS2322: Type 'T' is not assignable to type 'object | U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt index 4b034b06206df..72d7cfaf81eca 100644 --- a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt +++ b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt @@ -23,8 +23,10 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'? tests/cases/compiler/objectLiteralExcessProperties.ts(37,25): error TS2304: Cannot find name 'IFoo'. tests/cases/compiler/objectLiteralExcessProperties.ts(39,11): error TS2322: Type '{ name: string; }' is not assignable to type 'T'. + '{ name: string; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. tests/cases/compiler/objectLiteralExcessProperties.ts(41,11): error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type 'T & { prop: boolean; }'. Type '{ name: string; prop: boolean; }' is not assignable to type 'T'. + '{ name: string; prop: boolean; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. tests/cases/compiler/objectLiteralExcessProperties.ts(43,43): error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type 'T | { prop: boolean; }'. Object literal may only specify known properties, and 'name' does not exist in type '{ prop: boolean; }'. tests/cases/compiler/objectLiteralExcessProperties.ts(45,76): error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type '{ name: string; } | (T & { prop: boolean; })'. @@ -111,11 +113,13 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(49,44): error TS2322: Type const obj1: T = { name: "test" }; ~~~~ !!! error TS2322: Type '{ name: string; }' is not assignable to type 'T'. +!!! error TS2322: '{ name: string; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. // No excess property checks on intersections involving generics const obj2: T & { prop: boolean } = { name: "test", prop: true }; ~~~~ !!! error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type 'T & { prop: boolean; }'. !!! error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type 'T'. +!!! error TS2322: '{ name: string; prop: boolean; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. // Excess property checks only on non-generic parts of unions const obj3: T | { prop: boolean } = { name: "test", prop: true }; ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt index f112a590071a9..99dc4006ad951 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt @@ -5,11 +5,17 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec Types of property 'data' are incompatible. 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'. - Type 'MyList' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. + Type 'MyList' is not assignable to type 'T'. + 'MyList' is assignable to the constraint of type 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(31,5): error TS2322: Type 'T' is not assignable to type 'U'. - Type 'List' is not assignable to type 'U'. + 'T' is assignable to the constraint of type 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. + Type 'List' is not assignable to type 'U'. + 'List' is assignable to the constraint of type 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts(42,5): error TS2322: Type 'U' is not assignable to type 'T'. - Type 'MyList' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. + Type 'MyList' is not assignable to type 'T'. + 'MyList' is assignable to the constraint of type 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts (5 errors) ==== @@ -53,11 +59,15 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'MyList' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. +!!! error TS2322: Type 'MyList' is not assignable to type 'T'. +!!! error TS2322: 'MyList' is assignable to the constraint of type 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: Type 'List' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. +!!! error TS2322: Type 'List' is not assignable to type 'U'. +!!! error TS2322: 'List' is assignable to the constraint of type 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. var a: List; var b: MyList; @@ -71,7 +81,9 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'MyList' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. +!!! error TS2322: Type 'MyList' is not assignable to type 'T'. +!!! error TS2322: 'MyList' is assignable to the constraint of type 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. u = t; // was error, ok after constraint made illegal, doesn't matter var a: List; diff --git a/tests/baselines/reference/subtypesOfTypeParameter.errors.txt b/tests/baselines/reference/subtypesOfTypeParameter.errors.txt index 8983c26e153f0..fb80fd1ead1e7 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameter.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts(8,5): error TS2416: Property 'foo' in type 'D1' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts (1 errors) ==== @@ -14,6 +15,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D1' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. +!!! error TS2416: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } function f1(x: T, y: U) { diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt index 627a887d437ef..7b62e9d54f058 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt @@ -1,38 +1,53 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. - Type 'V' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + Type 'V' is not assignable to type 'T'. + 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2416: Property 'foo' in type 'D11' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'T'. + 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2416: Property 'foo' in type 'D12' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'U'. + 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2416: Property 'foo' in type 'D19' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. - Type 'V' is not assignable to type 'T'. - Type 'Date' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', 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' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'T'. - Type 'Date' is not assignable to type 'T'. + 'V' is assignable to the constraint of type 'Date', 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 'Date', 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' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'U'. - Type 'Date' is not assignable to type 'U'. + 'V' is assignable to the constraint of type 'Date', 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 'Date', 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' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'T'. + 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(161,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(161,5): error TS2416: Property 'foo' in type 'D28' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'U'. + 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(166,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(166,5): error TS2416: Property 'foo' in type 'D29' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'V'. + 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts (20 errors) ==== @@ -60,6 +75,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. +!!! error TS2416: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } class D4 extends C3 { @@ -96,7 +112,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: Type 'V' is not assignable to type 'T'. +!!! error TS2416: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: Type 'V' is not assignable to type 'T'. +!!! error TS2416: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } class D9 extends C3 { @@ -119,6 +137,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D11' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'T'. +!!! error TS2416: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } class D12 extends C3 { @@ -129,6 +148,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D12' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'U'. +!!! error TS2416: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } class D13 extends C3 { @@ -174,8 +194,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D19' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: Type 'V' is not assignable to type 'T'. -!!! error TS2416: Type 'Date' is not assignable to type 'T'. +!!! error TS2416: 'U' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. } class D20 extends C3 { @@ -203,7 +226,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D23' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'T'. -!!! error TS2416: Type 'Date' is not assignable to type 'T'. +!!! error TS2416: 'V' is assignable to the constraint of type 'Date', 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. } class D24 extends C3 { @@ -214,7 +239,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D24' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'U'. -!!! error TS2416: Type 'Date' is not assignable to type 'U'. +!!! error TS2416: 'V' is assignable to the constraint of type 'Date', 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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. } class D25 extends C3 { @@ -237,6 +264,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D27' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'T'. +!!! error TS2416: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. } class D28 extends C3 { @@ -247,6 +275,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D28' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'U'. +!!! error TS2416: 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. } class D29 extends C3 { @@ -257,4 +286,5 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D29' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'V'. +!!! error TS2416: 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. } \ No newline at end of file diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt index bdf0473df01a5..b8217ce3ef426 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt @@ -4,14 +4,18 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2416: Property 'foo' in type 'D5' is not assignable to the same property in base type 'B1'. Type 'U' is not assignable to type 'T'. - Type 'Foo' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + Type 'Foo' is not assignable to type 'T'. + 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint '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' is not assignable to the same property in base type 'B1'. Type 'V' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'B1'. Type 'T' is not assignable to type 'U'. - Type 'Foo' is not assignable to type 'U'. + 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + Type 'Foo' is not assignable to type 'U'. + 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint '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' is not assignable to the same property in base type 'B1'. Type 'V' is not assignable to type 'U'. @@ -85,7 +89,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D5' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: Type 'Foo' is not assignable to type 'T'. +!!! error TS2416: 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2416: Type 'Foo' is not assignable to type 'T'. +!!! error TS2416: 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. } class D6 extends B1 { @@ -106,7 +112,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'T' is not assignable to type 'U'. -!!! error TS2416: Type 'Foo' is not assignable to type 'U'. +!!! error TS2416: 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2416: Type 'Foo' is not assignable to type 'U'. +!!! error TS2416: 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. } class D8 extends B1 { diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt index b17196896067d..9156a7769e59f 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt @@ -6,6 +6,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type '(x: T) => string' is not assignable to type '(x: T) => T'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts (2 errors) ==== @@ -95,6 +96,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: T) => string' is not assignable to type '(x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt b/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt index 34fa5ee287adc..843ca8085ea98 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt @@ -3,27 +3,32 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(28,11): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(32,11): error TS2430: Interface 'I3' incorrectly extends interface 'A'. Types of property 'a3' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(36,11): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a4' are incompatible. Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(40,11): error TS2430: Interface 'I5' incorrectly extends interface 'A'. Types of property 'a5' are incompatible. Type 'new (x: (arg: T) => U) => T' is not assignable to type 'new (x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(44,11): error TS2430: Interface 'I7' incorrectly extends interface 'A'. Types of property 'a11' are incompatible. Type 'new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base' is not assignable to type 'new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base'. @@ -31,6 +36,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'foo' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(48,11): error TS2430: Interface 'I9' incorrectly extends interface 'A'. Types of property 'a16' are incompatible. Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: T; b: T; }) => T[]'. @@ -38,7 +44,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'a' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - Type 'Base' is not assignable to type 'T'. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + Type 'Base' is not assignable to type 'T'. + 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts (7 errors) ==== @@ -72,6 +80,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new (x: T) => T[]; } @@ -82,6 +91,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => string[]; } @@ -92,6 +102,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x: T) => T; } @@ -102,6 +113,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T, y: U) => string; } @@ -113,6 +125,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: (arg: T) => U) => T; } @@ -125,6 +138,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'foo' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; } @@ -137,6 +151,8 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: Type 'Base' is not assignable to type 'T'. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: Type 'Base' is not assignable to type 'T'. +!!! error TS2430: 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a16: new (x: { a: T; b: T }) => T[]; } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt index a862124666dc4..8247c87a55e6a 100644 --- a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt @@ -6,6 +6,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. Type 'string' is not assignable to type 'T'. + 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts (2 errors) ==== @@ -95,6 +96,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. +!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: new (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt index 1447c4d3105f9..ecd7ddb36ee72 100644 --- a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -8,10 +8,12 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a' are incompatible. Type '() => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x?: T) => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. @@ -19,30 +21,36 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type '() => T' is not assignable to type '(x?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(121,15): error TS2430: Interface 'I6' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type '(x: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '() => T' is not assignable to type '(x: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(134,15): error TS2430: Interface 'I9' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(138,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. @@ -50,40 +58,48 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a4' are incompatible. Type '() => T' is not assignable to type '(x: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(151,15): error TS2430: Interface 'I13' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(155,15): error TS2430: Interface 'I14' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(168,15): error TS2430: Interface 'I17' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(172,15): error TS2430: Interface 'I18' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. @@ -206,6 +222,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '() => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a: () => T; } @@ -215,6 +232,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x?: T) => T' is not assignable to type '() => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a: (x?: T) => T; } @@ -233,6 +251,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: () => T; } @@ -243,6 +262,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x?: T) => T } @@ -253,6 +273,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => T; } @@ -263,6 +284,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: () => T; } @@ -273,6 +295,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: (x?: T) => T; } @@ -283,6 +306,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: (x: T) => T; } @@ -301,6 +325,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: () => T; } @@ -311,6 +336,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x?: T, y?: T) => T; } @@ -321,6 +347,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x: T) => T; } @@ -331,6 +358,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T, y: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x: T, y: T) => T; } @@ -341,6 +369,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a5' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: () => T; } @@ -351,6 +380,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x?: T, y?: T) => T; } @@ -361,6 +391,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x: T) => T; } @@ -371,6 +402,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T, y: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x: T, y: T) => T; } } diff --git a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt index 28682b99a6604..0d8f51c2688e7 100644 --- a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt @@ -8,10 +8,12 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a' are incompatible. Type 'new () => T' is not assignable to type 'new () => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new () => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. @@ -19,30 +21,36 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type 'new () => T' is not assignable to type 'new (x?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new (x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(121,15): error TS2430: Interface 'I6' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new () => T' is not assignable to type 'new (x: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new (x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(134,15): error TS2430: Interface 'I9' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(138,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. @@ -50,40 +58,48 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a4' are incompatible. Type 'new () => T' is not assignable to type 'new (x: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(151,15): error TS2430: Interface 'I13' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(155,15): error TS2430: Interface 'I14' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new () => T' is not assignable to type 'new (x?: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(168,15): error TS2430: Interface 'I17' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(172,15): error TS2430: Interface 'I18' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. + 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. @@ -206,6 +222,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new () => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new () => T; } @@ -215,6 +232,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new () => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new (x?: T) => T; } @@ -233,6 +251,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new () => T; } @@ -243,6 +262,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new (x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x?: T) => T } @@ -253,6 +273,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => T; } @@ -263,6 +284,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new () => T; } @@ -273,6 +295,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x?: T) => T; } @@ -283,6 +306,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x: T) => T; } @@ -301,6 +325,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new () => T; } @@ -311,6 +336,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x?: T, y?: T) => T; } @@ -321,6 +347,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T) => T; } @@ -331,6 +358,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T, y: T) => T; } @@ -341,6 +369,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a5' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new () => T; } @@ -351,6 +380,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x?: T, y?: T) => T; } @@ -361,6 +391,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: T) => T; } @@ -371,6 +402,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T, y: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. +!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: T, y: T) => T; } } diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt index e5ff0d47ca305..a7f53b4411e44 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer.ts (2 errors) ==== @@ -43,6 +45,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B3' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: number]: Derived; // error, BUG? } @@ -51,6 +54,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: number]: Derived2; // error, BUG? } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt index a1e09eb270497..fc5477612e893 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt @@ -8,9 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer2.ts(36,15): error TS2430: Interface 'B4' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer2.ts (5 errors) ==== @@ -65,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B4' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived' is not assignable to type 'T'. +!!! error TS2430: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: number]: Derived; // error } @@ -73,6 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B5' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2430: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: number]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt index 6989d082ac8cf..48f6676b91bf1 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt @@ -8,9 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer3.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer3.ts (5 errors) ==== @@ -65,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: number]: Derived; // error } @@ -73,6 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B5' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: number]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt index 9dafcd925c38a..51a5f1c5f1320 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt @@ -8,9 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts(36,11): error TS2420: Class 'B4' incorrectly implements interface 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts(40,11): error TS2420: Class 'B5' incorrectly implements interface 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts (4 errors) ==== @@ -64,6 +66,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2420: Class 'B4' incorrectly implements interface 'A'. !!! error TS2420: Index signatures are incompatible. !!! error TS2420: Type 'Derived' is not assignable to type 'T'. +!!! error TS2420: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: string]: Derived; // error } @@ -72,6 +75,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2420: Class 'B5' incorrectly implements interface 'A'. !!! error TS2420: Index signatures are incompatible. !!! error TS2420: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2420: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: string]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithStringIndexer.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer.errors.txt index 4ad0f6654255b..a5156f0befe7c 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer.errors.txt @@ -1,9 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer.ts (2 errors) ==== @@ -43,6 +45,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B3' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: string]: Derived; // error } @@ -51,6 +54,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: string]: Derived2; // error } } diff --git a/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt index 953364b5b1faa..a2619411a20df 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt @@ -8,9 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer2.ts(36,15): error TS2430: Interface 'B4' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer2.ts (5 errors) ==== @@ -65,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B4' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived' is not assignable to type 'T'. +!!! error TS2430: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: string]: Derived; // error } @@ -73,6 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B5' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2430: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: string]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt index 3309c1da26607..64736f5278c3d 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt @@ -8,9 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer3.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. + 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. + 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer3.ts (5 errors) ==== @@ -65,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: string]: Derived; // error } @@ -73,6 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B5' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: string]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt index ae3d01d5e880d..a2f7a268032bb 100644 --- a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt +++ b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(14,14): error TS2322: Type '{}' is not assignable to type 'P'. + '{}' is assignable to the constraint of type '{}', but 'P' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(15,14): error TS2322: Type '{}' is not assignable to type 'Readonly

'. @@ -19,6 +20,7 @@ tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(15,14): error TS2322: Type let x = ; // should error ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'P'. +!!! error TS2322: '{}' is assignable to the constraint of type '{}', but 'P' could be instantiated with a different subtype of constraint '{}'. let y = ; // should error ~~~~~~~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'Readonly

'. @@ -20,7 +20,7 @@ tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(15,14): error TS2322: Type let x = ; // should error ~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'P'. -!!! error TS2322: '{}' is assignable to the constraint of type '{}', but 'P' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: '{}' is assignable to the constraint of type 'P', but 'P' could be instantiated with a different subtype of constraint '{}'. let y = ; // should error ~~~~~~~~~~~ !!! error TS2322: Type '{}' is not assignable to type 'Readonly

'. diff --git a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt index 3b31e3ecfdd73..2781d2fcee524 100644 --- a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt +++ b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1. @@ -12,7 +12,7 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro var r2 = f(1); ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt index 33d6894e72b4b..f0360609a575b 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'T' is not assignable to type 'number'. @@ -16,7 +16,7 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Typ !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt index ae855d6c2efa8..d1727b53863ca 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterArgumentEquivalence2.ts (2 errors) ==== @@ -17,12 +17,12 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Ty !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt index f2ff805bab035..c361a276b9622 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeParameterArgumentEquivalence3.ts(4,5): error TS2322: Type '(item: any) => boolean' is not assignable to type '(item: any) => T'. Type 'boolean' is not assignable to type 'T'. - 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'boolean' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence3.ts(5,5): error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => boolean'. Type 'T' is not assignable to type 'boolean'. @@ -13,7 +13,7 @@ tests/cases/compiler/typeParameterArgumentEquivalence3.ts(5,5): error TS2322: Ty ~ !!! error TS2322: Type '(item: any) => boolean' is not assignable to type '(item: any) => T'. !!! error TS2322: Type 'boolean' is not assignable to type 'T'. -!!! error TS2322: 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'boolean' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => boolean'. diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt index 23471c1dacab3..ce194146f6ca9 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/typeParameterArgumentEquivalence4.ts(4,5): error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence4.ts(5,5): error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterArgumentEquivalence4.ts (2 errors) ==== @@ -14,11 +14,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence4.ts(5,5): error TS2322: Ty ~ !!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt index 6f2f36adf2fe1..e5196d3d4a50d 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence5.ts(4,5): error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'. Type '(item: any) => T' is not assignable to type '(item: any) => U'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'. Type '(item: any) => U' is not assignable to type '(item: any) => T'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterArgumentEquivalence5.ts (2 errors) ==== @@ -17,12 +17,12 @@ tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Ty !!! error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'. !!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'. !!! error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignability.errors.txt b/tests/baselines/reference/typeParameterAssignability.errors.txt index 0abd590785e15..0bab4a4c74c69 100644 --- a/tests/baselines/reference/typeParameterAssignability.errors.txt +++ b/tests/baselines/reference/typeParameterAssignability.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(5,5): error TS2322: Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts (2 errors) ==== @@ -11,9 +11,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignability2.errors.txt b/tests/baselines/reference/typeParameterAssignability2.errors.txt index 4350ab169272b..776649105b40e 100644 --- a/tests/baselines/reference/typeParameterAssignability2.errors.txt +++ b/tests/baselines/reference/typeParameterAssignability2.errors.txt @@ -1,63 +1,63 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(5,5): error TS2322: Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(9,5): error TS2322: Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(14,5): error TS2322: Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. Type 'V' is not assignable to type 'T'. - 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(17,5): error TS2322: Type 'V' is not assignable to type 'T'. - 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(20,5): error TS2322: Type 'V' is not assignable to type 'U'. - 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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'. - 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. + '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(64,5): error TS2322: Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(65,5): error TS2322: Type 'V' is not assignable to type 'T'. - 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(68,5): error TS2322: Type 'V' is not assignable to type 'U'. - 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(70,5): error TS2322: Type 'T' is not assignable to type 'V'. - 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. Type 'U' is not assignable to type 'V'. - 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(71,5): error TS2322: Type 'U' is not assignable to type 'V'. - 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts (22 errors) ==== @@ -68,14 +68,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara u = t; // ok ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } function foo2(t: T, u: U) { t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // ok } @@ -83,21 +83,21 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'V' is not assignable to type 'T'. -!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; t = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'T'. -!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. v = t; // ok u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. v = u; // ok } @@ -105,38 +105,38 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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'. -!!! error TS2322: 'V' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. t = new Date(); // error ~ !!! error TS2322: Type 'Date' is not assignable to type 'T'. -!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. u = t; u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: 'V' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! 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'. -!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'. v = t; v = u; v = new Date(); // ok ~ !!! error TS2322: Type 'Date' is not assignable to type 'V'. -!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint 'Date'. var d: Date; d = t; // ok @@ -149,38 +149,38 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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'. -!!! error TS2322: 'V' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. t = new Date(); // error ~ !!! error TS2322: Type 'Date' is not assignable to type 'T'. -!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. u = t; u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: 'V' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! 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'. -!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'. v = t; v = u; v = new Date(); // ok ~ !!! error TS2322: Type 'Date' is not assignable to type 'V'. -!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint 'Date'. var d: Date; d = t; // ok @@ -192,26 +192,26 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. t = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'T'. -!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // ok u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. v = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'V'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'U' is not assignable to type 'V'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. v = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'V'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignability3.errors.txt b/tests/baselines/reference/typeParameterAssignability3.errors.txt index 57a5bc1541a20..52091c02b8f72 100644 --- a/tests/baselines/reference/typeParameterAssignability3.errors.txt +++ b/tests/baselines/reference/typeParameterAssignability3.errors.txt @@ -1,19 +1,19 @@ 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 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + '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'. - 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + 'Foo' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '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 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + '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'. - 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + 'Foo' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '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 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + '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'. - 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + 'Foo' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '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 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + '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'. - 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + 'Foo' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts (4 errors) ==== @@ -33,15 +33,15 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! 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: 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! 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: 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'. } class C { @@ -51,14 +51,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara this.t = this.u; // error ~~~~~~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! 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: 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '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 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! 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: 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'. } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt index 1a502e1799e3a..dfef4d192689c 100644 --- a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/typeParameterAssignmentCompat1.ts(8,5): error TS2322: Type 'Foo' is not assignable to type 'Foo'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterAssignmentCompat1.ts(9,5): error TS2322: Type 'Foo' is not assignable to type 'Foo'. tests/cases/compiler/typeParameterAssignmentCompat1.ts(16,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. @@ -18,7 +18,7 @@ tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type ~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. return x; ~~~~~~~~~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. diff --git a/tests/baselines/reference/typeParameterDiamond2.errors.txt b/tests/baselines/reference/typeParameterDiamond2.errors.txt index 1d524cecffd79..eecfac811275d 100644 --- a/tests/baselines/reference/typeParameterDiamond2.errors.txt +++ b/tests/baselines/reference/typeParameterDiamond2.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/typeParameterDiamond2.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'. - 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'U' is not assignable to type 'Top'. - 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterDiamond2.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. - 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'Bottom' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'T | U' is not assignable to type 'Top'. - 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'U' is not assignable to type 'Top'. - 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterDiamond2.ts (2 errors) ==== @@ -21,18 +21,18 @@ tests/cases/compiler/typeParameterDiamond2.ts(10,13): error TS2322: Type 'Bottom top = middle; ~~~ !!! error TS2322: Type 'T | U' is not assignable to type 'Top'. -!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'U' is not assignable to type 'Top'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. middle = bottom; top = bottom; ~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'Top'. -!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'T | U' is not assignable to type 'Top'. -!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'U' is not assignable to type 'Top'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. } } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterDiamond3.errors.txt b/tests/baselines/reference/typeParameterDiamond3.errors.txt index 2a1842afd2f3d..15abd9973d17e 100644 --- a/tests/baselines/reference/typeParameterDiamond3.errors.txt +++ b/tests/baselines/reference/typeParameterDiamond3.errors.txt @@ -1,24 +1,24 @@ tests/cases/compiler/typeParameterDiamond3.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'. - 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'T' is not assignable to type 'Top'. - 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterDiamond3.ts(9,13): error TS2322: Type 'Bottom' is not assignable to type 'T | U'. Type 'Top | T | U' is not assignable to type 'T | U'. Type 'Top' is not assignable to type 'T | U'. Type 'Top' is not assignable to type 'U'. - 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'Top' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. Type 'Bottom' is not assignable to type 'U'. - 'Bottom' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'Bottom' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. Type 'Top | T | U' is not assignable to type 'U'. - 'Top | T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'Top | T | U' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. Type 'Top' is not assignable to type 'U'. - 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'Top' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. - 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'Bottom' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'Top | T | U' is not assignable to type 'Top'. - 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'Top | T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'T' is not assignable to type 'Top'. - 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterDiamond3.ts (3 errors) ==== @@ -32,30 +32,30 @@ tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom top = middle; ~~~ !!! error TS2322: Type 'T | U' is not assignable to type 'Top'. -!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'T' is not assignable to type 'Top'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. middle = bottom; ~~~~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'T | U'. !!! error TS2322: Type 'Top | T | U' is not assignable to type 'T | U'. !!! error TS2322: Type 'Top' is not assignable to type 'T | U'. !!! error TS2322: Type 'Top' is not assignable to type 'U'. -!!! error TS2322: 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Top' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'Bottom' is not assignable to type 'U'. -!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'Top | T | U' is not assignable to type 'U'. -!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'Top' is not assignable to type 'U'. -!!! error TS2322: 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Top' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. top = bottom; ~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'Top'. -!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. -!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'T' is not assignable to type 'Top'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. } } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterDiamond4.errors.txt b/tests/baselines/reference/typeParameterDiamond4.errors.txt index 6bbd3ad33ab47..e135515389232 100644 --- a/tests/baselines/reference/typeParameterDiamond4.errors.txt +++ b/tests/baselines/reference/typeParameterDiamond4.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/typeParameterDiamond4.ts(8,13): error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. - 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'Top | T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'T' is not assignable to type 'Top'. - 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterDiamond4.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. - 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'Bottom' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'Top | T | U' is not assignable to type 'Top'. - 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'Top | T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'T' is not assignable to type 'Top'. - 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterDiamond4.ts (2 errors) ==== @@ -21,18 +21,18 @@ tests/cases/compiler/typeParameterDiamond4.ts(10,13): error TS2322: Type 'Bottom top = middle; ~~~ !!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. -!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'T' is not assignable to type 'Top'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. middle = bottom; top = bottom; ~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'Top'. -!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. -!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'T' is not assignable to type 'Top'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'Top', but 'Top' could be instantiated with a different subtype of constraint '{}'. } } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt index 7da521bef2953..30f71cdfeba1b 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'. - 'Object' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Object' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? @@ -12,11 +12,11 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type x = y; // Error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. x = z; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. -!!! error TS2322: 'Object' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Object' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? z = x; // Ok } diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt index 928b059f53999..5d04f500fd691 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt @@ -1,17 +1,17 @@ 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(6,5): error TS2322: Type 'T' is not assignable to type 'V'. - 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. Type 'Date' is not assignable to type 'V'. - 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(7,5): error TS2322: Type 'V' is not assignable to type 'U'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(8,5): error TS2322: Type 'U' is not assignable to type 'V'. - 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. Type 'Date' is not assignable to type 'V'. - 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type 'Object' is not assignable to type 'T'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? @@ -23,27 +23,27 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type x = y; // Ok ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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'. z = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'V'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'Date' is not assignable to type 'V'. -!!! error TS2322: 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. y = z; // Error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. z = y; // Error ~ !!! error TS2322: Type 'U' is not assignable to type 'V'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'Date' is not assignable to type 'V'. -!!! error TS2322: 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. x = zz; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt index f2c430342af26..fcc9c0d3c8786 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt @@ -1,10 +1,10 @@ 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 'Object', but 'T' could be instantiated with a different subtype of constraint 'Object'. + '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 'Object', but 'T' could be instantiated with a different subtype of constraint 'Object'. + '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 'Object', but 'T' could be instantiated with a different subtype of constraint 'Object'. + '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? @@ -15,14 +15,14 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type x = y; // Ok ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'Object', but 'T' could be instantiated with a different subtype of constraint 'Object'. +!!! 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 'Object', but 'T' could be instantiated with a different subtype of constraint 'Object'. +!!! 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'. -!!! error TS2322: 'Object' is assignable to the constraint of type 'Object', but 'T' could be instantiated with a different subtype of constraint 'Object'. +!!! 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? z = x; // Ok } diff --git a/tests/baselines/reference/typeRelationships.errors.txt b/tests/baselines/reference/typeRelationships.errors.txt index a36b196c6004e..6176fc84d2cfb 100644 --- a/tests/baselines/reference/typeRelationships.errors.txt +++ b/tests/baselines/reference/typeRelationships.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/types/thisType/typeRelationships.ts(9,9): error TS2322: Type 'C' is not assignable to type 'this'. - 'C' is assignable to the constraint of type 'C', but 'this' could be instantiated with a different subtype of constraint 'C'. + 'C' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'C'. tests/cases/conformance/types/thisType/typeRelationships.ts(35,9): error TS2739: Type 'C' is missing the following properties from type 'D': self1, self2, self3, d, bar tests/cases/conformance/types/thisType/typeRelationships.ts(36,9): error TS2322: Type 'D' is not assignable to type 'this'. - 'D' is assignable to the constraint of type 'D', but 'this' could be instantiated with a different subtype of constraint 'D'. + 'D' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'D'. ==== tests/cases/conformance/types/thisType/typeRelationships.ts (3 errors) ==== @@ -17,7 +17,7 @@ tests/cases/conformance/types/thisType/typeRelationships.ts(36,9): error TS2322: this.self = this.c; // Error ~~~~~~~~~ !!! error TS2322: Type 'C' is not assignable to type 'this'. -!!! error TS2322: 'C' is assignable to the constraint of type 'C', but 'this' could be instantiated with a different subtype of constraint 'C'. +!!! error TS2322: 'C' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'C'. } f2() { var a: C[]; @@ -49,7 +49,7 @@ tests/cases/conformance/types/thisType/typeRelationships.ts(36,9): error TS2322: this.self = this.d; // Error ~~~~~~~~~ !!! error TS2322: Type 'D' is not assignable to type 'this'. -!!! error TS2322: 'D' is assignable to the constraint of type 'D', but 'this' could be instantiated with a different subtype of constraint 'D'. +!!! error TS2322: 'D' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'D'. this.c = this.d; } } diff --git a/tests/baselines/reference/unionTypesAssignability.errors.txt b/tests/baselines/reference/unionTypesAssignability.errors.txt index 051b13abc1960..5affcf89ea57c 100644 --- a/tests/baselines/reference/unionTypesAssignability.errors.txt +++ b/tests/baselines/reference/unionTypesAssignability.errors.txt @@ -19,17 +19,17 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(43,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(64,5): error TS2322: Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(65,5): error TS2322: Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(70,5): error TS2322: Type 'T | U' is not assignable to type 'T'. - 'T | U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T | U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(71,5): error TS2322: Type 'T | U' is not assignable to type 'U'. - 'T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T | U' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts (19 errors) ==== @@ -138,11 +138,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. var x : T | U; x = t; // ok x = u; // ok @@ -150,14 +150,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp t = x; // error U not assignable to T ~ !!! error TS2322: Type 'T | U' is not assignable to type 'T'. -!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T | U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. u = x; // error T not assignable to U ~ !!! error TS2322: Type 'T | U' is not assignable to type 'U'. -!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T | U' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file From 60c41269d4912546b066a5065f9bd44e42c0593f Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 25 Apr 2019 15:17:40 -0700 Subject: [PATCH 3/3] Align formatting with local custom --- src/compiler/checker.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 73786a226c3ca..ed39e1d628433 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12260,11 +12260,7 @@ namespace ts { targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); } - if ( - target.flags & TypeFlags.TypeParameter - && target.immediateBaseConstraint !== undefined - && isTypeAssignableTo(source, target.immediateBaseConstraint) - ) { + if (target.flags & TypeFlags.TypeParameter && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) { reportError( Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType,

'. diff --git a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt index a162b997c0f6d..3b31e3ecfdd73 100644 --- a/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt +++ b/tests/baselines/reference/typeArgumentsOnFunctionsWithNoTypeParameters.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(2,15): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(3,15): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. + '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): error TS2558: Expected 0 type arguments, but got 1. @@ -11,6 +12,7 @@ tests/cases/compiler/typeArgumentsOnFunctionsWithNoTypeParameters.ts(4,15): erro var r2 = f(1); ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. +!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt index 39e6db64fbf3c..33d6894e72b4b 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'number' is not assignable to type 'T'. + 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'T' is not assignable to type 'number'. @@ -15,6 +16,7 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Typ !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt index 17fce0384f780..ae855d6c2efa8 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt @@ -1,9 +1,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterArgumentEquivalence2.ts (2 errors) ==== @@ -15,10 +17,12 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Ty !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt index 1f126d7c00daa..f2ff805bab035 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence3.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/typeParameterArgumentEquivalence3.ts(4,5): error TS2322: Type '(item: any) => boolean' is not assignable to type '(item: any) => T'. Type 'boolean' is not assignable to type 'T'. + 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence3.ts(5,5): error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => boolean'. Type 'T' is not assignable to type 'boolean'. @@ -12,6 +13,7 @@ tests/cases/compiler/typeParameterArgumentEquivalence3.ts(5,5): error TS2322: Ty ~ !!! error TS2322: Type '(item: any) => boolean' is not assignable to type '(item: any) => T'. !!! error TS2322: Type 'boolean' is not assignable to type 'T'. +!!! error TS2322: 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => boolean'. diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt index c7b19e8725c70..23471c1dacab3 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence4.errors.txt @@ -1,7 +1,9 @@ tests/cases/compiler/typeParameterArgumentEquivalence4.ts(4,5): error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence4.ts(5,5): error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterArgumentEquivalence4.ts (2 errors) ==== @@ -12,9 +14,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence4.ts(5,5): error TS2322: Ty ~ !!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt index 82290733a9e0f..6f2f36adf2fe1 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence5.errors.txt @@ -1,9 +1,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence5.ts(4,5): error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'. Type '(item: any) => T' is not assignable to type '(item: any) => U'. Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'. Type '(item: any) => U' is not assignable to type '(item: any) => T'. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterArgumentEquivalence5.ts (2 errors) ==== @@ -15,10 +17,12 @@ tests/cases/compiler/typeParameterArgumentEquivalence5.ts(5,5): error TS2322: Ty !!! error TS2322: Type '() => (item: any) => T' is not assignable to type '() => (item: any) => U'. !!! error TS2322: Type '(item: any) => T' is not assignable to type '(item: any) => U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. y = x; // Shound be an error ~ !!! error TS2322: Type '() => (item: any) => U' is not assignable to type '() => (item: any) => T'. !!! error TS2322: Type '(item: any) => U' is not assignable to type '(item: any) => T'. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignability.errors.txt b/tests/baselines/reference/typeParameterAssignability.errors.txt index 0e8546097d0c3..0abd590785e15 100644 --- a/tests/baselines/reference/typeParameterAssignability.errors.txt +++ b/tests/baselines/reference/typeParameterAssignability.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts(5,5): error TS2322: Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability.ts (2 errors) ==== @@ -9,7 +11,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignability2.errors.txt b/tests/baselines/reference/typeParameterAssignability2.errors.txt index 9d32aed12328d..4350ab169272b 100644 --- a/tests/baselines/reference/typeParameterAssignability2.errors.txt +++ b/tests/baselines/reference/typeParameterAssignability2.errors.txt @@ -1,33 +1,63 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(5,5): error TS2322: Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(9,5): error TS2322: Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(14,5): error TS2322: Type 'U' is not assignable to type 'T'. - Type 'V' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + Type 'V' is not assignable to type 'T'. + 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(17,5): error TS2322: Type 'V' is not assignable to type 'T'. + 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(20,5): error TS2322: Type 'V' is not assignable to type 'U'. + 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(25,5): error TS2322: Type 'U' is not assignable to type 'T'. - Type 'V' is not assignable to type 'T'. - Type 'Date' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', 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 'Date', 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 'Date', 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'. - Type 'Date' is not assignable to type 'U'. + 'V' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', 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 'Date', 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'. - Type 'V' is not assignable to type 'T'. - Type 'Date' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', 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 'Date', 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 'Date', 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'. - Type 'Date' is not assignable to type 'U'. + 'V' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', 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'. + 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(64,5): error TS2322: Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(65,5): error TS2322: Type 'V' is not assignable to type 'T'. + 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(68,5): error TS2322: Type 'V' is not assignable to type 'U'. + 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(70,5): error TS2322: Type 'T' is not assignable to type 'V'. - Type 'U' is not assignable to type 'V'. + 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + Type 'U' is not assignable to type 'V'. + 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(71,5): error TS2322: Type 'U' is not assignable to type 'V'. + 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts (22 errors) ==== @@ -38,12 +68,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara u = t; // ok ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } function foo2(t: T, u: U) { t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // ok } @@ -51,17 +83,21 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'V' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'V' is not assignable to type 'T'. +!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; t = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'T'. +!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. v = t; // ok u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. +!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. v = u; // ok } @@ -69,29 +105,38 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'V' is not assignable to type 'T'. -!!! error TS2322: Type 'Date' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', 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'. +!!! error TS2322: 'V' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. t = new Date(); // error ~ !!! error TS2322: Type 'Date' is not assignable to type 'T'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. u = t; u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: Type 'Date' is not assignable to type 'U'. +!!! error TS2322: 'V' is assignable to the constraint of type 'Date', 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 'Date', 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'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. v = t; v = u; v = new Date(); // ok ~ !!! error TS2322: Type 'Date' is not assignable to type 'V'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. var d: Date; d = t; // ok @@ -104,29 +149,38 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'V' is not assignable to type 'T'. -!!! error TS2322: Type 'Date' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type 'Date', 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 'Date', 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 'Date', 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'. +!!! error TS2322: 'V' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. t = new Date(); // error ~ !!! error TS2322: Type 'Date' is not assignable to type 'T'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. u = t; u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: Type 'Date' is not assignable to type 'U'. +!!! error TS2322: 'V' is assignable to the constraint of type 'Date', 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 'Date', 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'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. v = t; v = u; v = new Date(); // ok ~ !!! error TS2322: Type 'Date' is not assignable to type 'V'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. var d: Date; d = t; // ok @@ -138,20 +192,26 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. t = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'T'. +!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // ok u = v; // error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. +!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. v = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'V'. -!!! error TS2322: Type 'U' is not assignable to type 'V'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'U' is not assignable to type 'V'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. v = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'V'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignability3.errors.txt b/tests/baselines/reference/typeParameterAssignability3.errors.txt index ca7850d747e40..57a5bc1541a20 100644 --- a/tests/baselines/reference/typeParameterAssignability3.errors.txt +++ b/tests/baselines/reference/typeParameterAssignability3.errors.txt @@ -1,11 +1,19 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(14,5): error TS2322: Type 'U' is not assignable to type 'T'. - Type 'Foo' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + Type 'Foo' is not assignable to type 'T'. + 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(15,5): error TS2322: Type 'T' is not assignable to type 'U'. - Type 'Foo' is not assignable to type 'U'. + 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + Type 'Foo' is not assignable to type 'U'. + 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(22,9): error TS2322: Type 'U' is not assignable to type 'T'. - Type 'Foo' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + Type 'Foo' is not assignable to type 'T'. + 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts(23,9): error TS2322: Type 'T' is not assignable to type 'U'. - Type 'Foo' is not assignable to type 'U'. + 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + Type 'Foo' is not assignable to type 'U'. + 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability3.ts (4 errors) ==== @@ -25,11 +33,15 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'Foo' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: Type 'Foo' is not assignable to type 'T'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: Type 'Foo' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: Type 'Foo' is not assignable to type 'U'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. } class C { @@ -39,10 +51,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara this.t = this.u; // error ~~~~~~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'Foo' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: Type 'Foo' is not assignable to type 'T'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. this.u = this.t; // error ~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: Type 'Foo' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2322: Type 'Foo' is not assignable to type 'U'. +!!! error TS2322: 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt index 2ca4299c7f8d6..1a502e1799e3a 100644 --- a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/typeParameterAssignmentCompat1.ts(8,5): error TS2322: Type 'Foo' is not assignable to type 'Foo'. Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterAssignmentCompat1.ts(9,5): error TS2322: Type 'Foo' is not assignable to type 'Foo'. tests/cases/compiler/typeParameterAssignmentCompat1.ts(16,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. @@ -17,6 +18,7 @@ tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type ~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. return x; ~~~~~~~~~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. diff --git a/tests/baselines/reference/typeParameterDiamond2.errors.txt b/tests/baselines/reference/typeParameterDiamond2.errors.txt index f268724c6efaa..1d524cecffd79 100644 --- a/tests/baselines/reference/typeParameterDiamond2.errors.txt +++ b/tests/baselines/reference/typeParameterDiamond2.errors.txt @@ -1,8 +1,13 @@ tests/cases/compiler/typeParameterDiamond2.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'. - Type 'U' is not assignable to type 'Top'. -tests/cases/compiler/typeParameterDiamond2.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. - Type 'T | U' is not assignable to type 'Top'. + 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'U' is not assignable to type 'Top'. + 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +tests/cases/compiler/typeParameterDiamond2.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. + 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + Type 'T | U' is not assignable to type 'Top'. + 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + Type 'U' is not assignable to type 'Top'. + 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterDiamond2.ts (2 errors) ==== @@ -16,13 +21,18 @@ tests/cases/compiler/typeParameterDiamond2.ts(10,13): error TS2322: Type 'Bottom top = middle; ~~~ !!! error TS2322: Type 'T | U' is not assignable to type 'Top'. -!!! error TS2322: Type 'U' is not assignable to type 'Top'. +!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'U' is not assignable to type 'Top'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. middle = bottom; top = bottom; ~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'Top'. -!!! error TS2322: Type 'T | U' is not assignable to type 'Top'. -!!! error TS2322: Type 'U' is not assignable to type 'Top'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'T | U' is not assignable to type 'Top'. +!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'U' is not assignable to type 'Top'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. } } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterDiamond3.errors.txt b/tests/baselines/reference/typeParameterDiamond3.errors.txt index 14d5e4a313aac..2a1842afd2f3d 100644 --- a/tests/baselines/reference/typeParameterDiamond3.errors.txt +++ b/tests/baselines/reference/typeParameterDiamond3.errors.txt @@ -1,15 +1,24 @@ tests/cases/compiler/typeParameterDiamond3.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'. - Type 'T' is not assignable to type 'Top'. + 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + Type 'T' is not assignable to type 'Top'. + 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterDiamond3.ts(9,13): error TS2322: Type 'Bottom' is not assignable to type 'T | U'. Type 'Top | T | U' is not assignable to type 'T | U'. Type 'Top' is not assignable to type 'T | U'. Type 'Top' is not assignable to type 'U'. - Type 'Bottom' is not assignable to type 'U'. - Type 'Top | T | U' is not assignable to type 'U'. - Type 'Top' is not assignable to type 'U'. + 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + Type 'Bottom' is not assignable to type 'U'. + 'Bottom' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + Type 'Top | T | U' is not assignable to type 'U'. + 'Top | T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + Type 'Top' is not assignable to type 'U'. + 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. - Type 'Top | T | U' is not assignable to type 'Top'. - Type 'T' is not assignable to type 'Top'. + 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + Type 'Top | T | U' is not assignable to type 'Top'. + 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + Type 'T' is not assignable to type 'Top'. + 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterDiamond3.ts (3 errors) ==== @@ -23,21 +32,30 @@ tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom top = middle; ~~~ !!! error TS2322: Type 'T | U' is not assignable to type 'Top'. -!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. middle = bottom; ~~~~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'T | U'. !!! error TS2322: Type 'Top | T | U' is not assignable to type 'T | U'. !!! error TS2322: Type 'Top' is not assignable to type 'T | U'. !!! error TS2322: Type 'Top' is not assignable to type 'U'. -!!! error TS2322: Type 'Bottom' is not assignable to type 'U'. -!!! error TS2322: Type 'Top | T | U' is not assignable to type 'U'. -!!! error TS2322: Type 'Top' is not assignable to type 'U'. +!!! error TS2322: 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'Bottom' is not assignable to type 'U'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'Top | T | U' is not assignable to type 'U'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'Top' is not assignable to type 'U'. +!!! error TS2322: 'Top' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. top = bottom; ~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'Top'. -!!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. -!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. } } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterDiamond4.errors.txt b/tests/baselines/reference/typeParameterDiamond4.errors.txt index 2a7fbdaf15c9f..6bbd3ad33ab47 100644 --- a/tests/baselines/reference/typeParameterDiamond4.errors.txt +++ b/tests/baselines/reference/typeParameterDiamond4.errors.txt @@ -1,8 +1,13 @@ tests/cases/compiler/typeParameterDiamond4.ts(8,13): error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. - Type 'T' is not assignable to type 'Top'. -tests/cases/compiler/typeParameterDiamond4.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. - Type 'Top | T | U' is not assignable to type 'Top'. + 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. Type 'T' is not assignable to type 'Top'. + 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +tests/cases/compiler/typeParameterDiamond4.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. + 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + Type 'Top | T | U' is not assignable to type 'Top'. + 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. + Type 'T' is not assignable to type 'Top'. + 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/typeParameterDiamond4.ts (2 errors) ==== @@ -16,13 +21,18 @@ tests/cases/compiler/typeParameterDiamond4.ts(10,13): error TS2322: Type 'Bottom top = middle; ~~~ !!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. -!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. middle = bottom; top = bottom; ~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'Top'. -!!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. -!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'Bottom' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'. +!!! error TS2322: 'Top | T | U' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'T' is not assignable to type 'Top'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'Top' could be instantiated with a different subtype of constraint '{}'. } } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt index b5c9fd60206fc..7da521bef2953 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt @@ -1,6 +1,8 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + 'Object' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? ==== tests/cases/compiler/typeParametersShouldNotBeEqual.ts (2 errors) ==== @@ -10,10 +12,12 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type x = y; // Error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. x = z; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: 'Object' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? z = x; // Ok } \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt index d452b99798094..928b059f53999 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt @@ -1,11 +1,17 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. - Type 'Date' is not assignable to type 'T'. + 'U' is assignable to the constraint of type 'Date', 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 'Date', 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'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(6,5): error TS2322: Type 'T' is not assignable to type 'V'. - Type 'Date' is not assignable to type 'V'. + 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + Type 'Date' is not assignable to type 'V'. + 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(7,5): error TS2322: Type 'V' is not assignable to type 'U'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(8,5): error TS2322: Type 'U' is not assignable to type 'V'. - Type 'Date' is not assignable to type 'V'. + 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + Type 'Date' is not assignable to type 'V'. + 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type 'Object' is not assignable to type 'T'. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? @@ -17,21 +23,27 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type x = y; // Ok ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'Date' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type 'Date', 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 'Date', 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'. z = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'V'. -!!! error TS2322: Type 'Date' is not assignable to type 'V'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'Date' is not assignable to type 'V'. +!!! error TS2322: 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. y = z; // Error ~ !!! error TS2322: Type 'V' is not assignable to type 'U'. z = y; // Error ~ !!! error TS2322: Type 'U' is not assignable to type 'V'. -!!! error TS2322: Type 'Date' is not assignable to type 'V'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'Date' is not assignable to type 'V'. +!!! error TS2322: 'Date' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. x = zz; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt index 816db440a4c6d..f2c430342af26 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt @@ -1,8 +1,11 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. - Type 'Object' is not assignable to type 'T'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + 'U' is assignable to the constraint of type 'Object', 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 'Object', 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'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + 'Object' is assignable to the constraint of type 'Object', 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 (2 errors) ==== @@ -12,12 +15,15 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type x = y; // Ok ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: Type 'Object' is not assignable to type 'T'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: 'U' is assignable to the constraint of type 'Object', 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 'Object', 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'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: 'Object' is assignable to the constraint of type 'Object', 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? z = x; // Ok } \ No newline at end of file diff --git a/tests/baselines/reference/typeRelationships.errors.txt b/tests/baselines/reference/typeRelationships.errors.txt index 36f127224022d..a36b196c6004e 100644 --- a/tests/baselines/reference/typeRelationships.errors.txt +++ b/tests/baselines/reference/typeRelationships.errors.txt @@ -1,6 +1,8 @@ tests/cases/conformance/types/thisType/typeRelationships.ts(9,9): error TS2322: Type 'C' is not assignable to type 'this'. + 'C' is assignable to the constraint of type 'C', but 'this' could be instantiated with a different subtype of constraint 'C'. tests/cases/conformance/types/thisType/typeRelationships.ts(35,9): error TS2739: Type 'C' is missing the following properties from type 'D': self1, self2, self3, d, bar tests/cases/conformance/types/thisType/typeRelationships.ts(36,9): error TS2322: Type 'D' is not assignable to type 'this'. + 'D' is assignable to the constraint of type 'D', but 'this' could be instantiated with a different subtype of constraint 'D'. ==== tests/cases/conformance/types/thisType/typeRelationships.ts (3 errors) ==== @@ -15,6 +17,7 @@ tests/cases/conformance/types/thisType/typeRelationships.ts(36,9): error TS2322: this.self = this.c; // Error ~~~~~~~~~ !!! error TS2322: Type 'C' is not assignable to type 'this'. +!!! error TS2322: 'C' is assignable to the constraint of type 'C', but 'this' could be instantiated with a different subtype of constraint 'C'. } f2() { var a: C[]; @@ -46,6 +49,7 @@ tests/cases/conformance/types/thisType/typeRelationships.ts(36,9): error TS2322: this.self = this.d; // Error ~~~~~~~~~ !!! error TS2322: Type 'D' is not assignable to type 'this'. +!!! error TS2322: 'D' is assignable to the constraint of type 'D', but 'this' could be instantiated with a different subtype of constraint 'D'. this.c = this.d; } } diff --git a/tests/baselines/reference/unionTypesAssignability.errors.txt b/tests/baselines/reference/unionTypesAssignability.errors.txt index b74bbbd4e08ac..051b13abc1960 100644 --- a/tests/baselines/reference/unionTypesAssignability.errors.txt +++ b/tests/baselines/reference/unionTypesAssignability.errors.txt @@ -19,11 +19,17 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(43,1): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(64,5): error TS2322: Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(65,5): error TS2322: Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(70,5): error TS2322: Type 'T | U' is not assignable to type 'T'. - Type 'U' is not assignable to type 'T'. + 'T | U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + Type 'U' is not assignable to type 'T'. + 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(71,5): error TS2322: Type 'T | U' is not assignable to type 'U'. - Type 'T' is not assignable to type 'U'. + 'T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + Type 'T' is not assignable to type 'U'. + 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts (19 errors) ==== @@ -132,9 +138,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. var x : T | U; x = t; // ok x = u; // ok @@ -142,10 +150,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp t = x; // error U not assignable to T ~ !!! error TS2322: Type 'T | U' is not assignable to type 'T'. -!!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. u = x; // error T not assignable to U ~ !!! error TS2322: Type 'T | U' is not assignable to type 'U'. -!!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T | U' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file From 9323c7ae188d2f30a45371c02e4e258138f38e73 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 18 Mar 2019 15:08:00 -0400 Subject: [PATCH 2/3] Updated diagnostic message per suggestion --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- ...gnmentCompatWithCallSignatures3.errors.txt | 28 ++-- ...gnmentCompatWithCallSignatures4.errors.txt | 16 +-- ...gnmentCompatWithCallSignatures5.errors.txt | 8 +- ...gnmentCompatWithCallSignatures6.errors.txt | 4 +- ...tCompatWithConstructSignatures3.errors.txt | 28 ++-- ...tCompatWithConstructSignatures4.errors.txt | 16 +-- ...tCompatWithConstructSignatures5.errors.txt | 8 +- ...tCompatWithConstructSignatures6.errors.txt | 4 +- ...ompatWithGenericCallSignatures2.errors.txt | 4 +- ...ignaturesWithOptionalParameters.errors.txt | 92 +++++++------- ...ignmentCompatWithNumericIndexer.errors.txt | 8 +- ...gnmentCompatWithNumericIndexer2.errors.txt | 8 +- ...gnmentCompatWithNumericIndexer3.errors.txt | 4 +- ...signmentCompatWithStringIndexer.errors.txt | 8 +- ...ignmentCompatWithStringIndexer2.errors.txt | 8 +- .../assignmentStricterConstraints.errors.txt | 4 +- .../baseConstraintOfDecorator.errors.txt | 4 +- ...atureAssignabilityInInheritance.errors.txt | 4 +- ...tureAssignabilityInInheritance3.errors.txt | 8 +- ...tureAssignabilityInInheritance6.errors.txt | 32 ++--- ...onstrainedToOtherTypeParameter2.errors.txt | 8 +- ...maOperatorOtherInvalidOperation.errors.txt | 4 +- .../complexRecursiveCollections.errors.txt | 12 +- .../reference/conditionalTypes1.errors.txt | 24 ++-- .../reference/conditionalTypes2.errors.txt | 12 +- ...atureAssignabilityInInheritance.errors.txt | 4 +- ...tureAssignabilityInInheritance3.errors.txt | 8 +- ...tureAssignabilityInInheritance6.errors.txt | 32 ++--- ...mplementationWithDefaultValues2.errors.txt | 12 +- ...rWithAssignableReturnExpression.errors.txt | 4 +- .../derivedGenericClassWithAny.errors.txt | 8 +- .../reference/enumAssignability.errors.txt | 16 +-- ...sIntoApparentlyPresentPropsOnly.errors.txt | 4 +- ...rrorMessagesIntersectionTypes03.errors.txt | 12 +- ...ionTypeArgumentAssignmentCompat.errors.txt | 4 +- ...cCallWithFunctionTypedArguments.errors.txt | 12 +- ...lWithGenericSignatureArguments2.errors.txt | 8 +- ...thObjectTypeArgsAndConstraints4.errors.txt | 4 +- ...thObjectTypeArgsAndConstraints5.errors.txt | 4 +- ...thObjectTypeArgsAndInitializers.errors.txt | 16 +-- ...kedInsideItsContainingFunction1.errors.txt | 8 +- ...ithFunctionTypedMemberArguments.errors.txt | 12 +- .../genericDefaultsErrors.errors.txt | 8 +- ...CallSignatureReturnTypeMismatch.errors.txt | 4 +- .../genericTypeAssertions4.errors.txt | 20 +-- .../genericTypeAssertions5.errors.txt | 20 +-- .../genericTypeAssertions6.errors.txt | 16 +-- .../genericWithOpenTypeParameters1.errors.txt | 4 +- .../getAndSetNotIdenticalType2.errors.txt | 4 +- ...ementGenericWithMismatchedTypes.errors.txt | 4 +- ...signmentOfIdenticallyNamedTypes.errors.txt | 4 +- .../indexSignatureAndMappedType.errors.txt | 4 +- ...teExpansionThroughInstantiation.errors.txt | 4 +- .../intersectionTypeInference.errors.txt | 8 +- .../invalidBooleanAssignments.errors.txt | 4 +- .../invalidNumberAssignments.errors.txt | 4 +- .../invalidStringAssignments.errors.txt | 4 +- .../keyofAndIndexedAccessErrors.errors.txt | 52 ++++---- .../mappedTypeRelationships.errors.txt | 80 ++++++------ .../reference/mappedTypes5.errors.txt | 2 + .../reference/mappedTypes6.errors.txt | 12 +- .../nonPrimitiveAndTypeVariables.errors.txt | 4 +- .../objectLiteralExcessProperties.errors.txt | 8 +- ...WrappedPropertyCheckedNominally.errors.txt | 24 ++-- .../subtypesOfTypeParameter.errors.txt | 4 +- ...sOfTypeParameterWithConstraints.errors.txt | 60 ++++----- ...OfTypeParameterWithConstraints4.errors.txt | 16 +-- ...aturesWithSpecializedSignatures.errors.txt | 4 +- ...btypingWithConstructSignatures6.errors.txt | 32 ++--- ...aturesWithSpecializedSignatures.errors.txt | 4 +- ...ignaturesWithOptionalParameters.errors.txt | 64 +++++----- ...ignaturesWithOptionalParameters.errors.txt | 64 +++++----- .../subtypingWithNumericIndexer.errors.txt | 8 +- .../subtypingWithNumericIndexer2.errors.txt | 8 +- .../subtypingWithNumericIndexer3.errors.txt | 8 +- .../subtypingWithNumericIndexer5.errors.txt | 8 +- .../subtypingWithStringIndexer.errors.txt | 8 +- .../subtypingWithStringIndexer2.errors.txt | 8 +- .../subtypingWithStringIndexer3.errors.txt | 8 +- .../tsxNotUsingApparentTypeOfSFC.errors.txt | 4 +- ...OnFunctionsWithNoTypeParameters.errors.txt | 4 +- ...ypeParameterArgumentEquivalence.errors.txt | 4 +- ...peParameterArgumentEquivalence2.errors.txt | 8 +- ...peParameterArgumentEquivalence3.errors.txt | 4 +- ...peParameterArgumentEquivalence4.errors.txt | 8 +- ...peParameterArgumentEquivalence5.errors.txt | 8 +- .../typeParameterAssignability.errors.txt | 8 +- .../typeParameterAssignability2.errors.txt | 120 +++++++++--------- .../typeParameterAssignability3.errors.txt | 32 ++--- .../typeParameterAssignmentCompat1.errors.txt | 4 +- .../typeParameterDiamond2.errors.txt | 20 +-- .../typeParameterDiamond3.errors.txt | 36 +++--- .../typeParameterDiamond4.errors.txt | 20 +-- .../typeParametersShouldNotBeEqual.errors.txt | 8 +- ...typeParametersShouldNotBeEqual2.errors.txt | 24 ++-- ...typeParametersShouldNotBeEqual3.errors.txt | 12 +- .../reference/typeRelationships.errors.txt | 8 +- .../unionTypesAssignability.errors.txt | 24 ++-- 100 files changed, 742 insertions(+), 740 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1482b0d464a60..de94640e0421d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12113,7 +12113,7 @@ namespace ts { && isTypeAssignableTo(source, target.immediateBaseConstraint) ) { reportError( - Diagnostics._0_is_assignable_to_the_constraint_of_type_2_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, + Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint), diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 2c3d1ab3690c4..ceaad7c91309c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3072,7 +3072,7 @@ "category": "Error", "code": 5073 }, - "'{0}' is assignable to the constraint of type '{2}', but '{1}' could be instantiated with a different subtype of constraint '{2}'.": { + "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'.": { "category": "Error", "code": 5074 }, diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt index 7a2534cc58cbd..a0c856cae96f7 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt @@ -14,30 +14,30 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(62,1): error TS2322: Type '(x: (arg: Base) => Derived) => Base' is not assignable to type '(x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(65,1): error TS2322: Type '(x: (arg: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(68,1): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(71,1): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(74,1): error TS2322: Type '(...x: Derived[]) => Derived' is not assignable to type '(...x: T[]) => T'. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(77,1): error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '(x: T, y: T) => T'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type '{ foo: string; bar: string; }'. @@ -49,7 +49,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(83,1): error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '(x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. - 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. + 'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures3.ts(85,1): error TS2322: Type '(x: { a: T; b: T; }) => T' is not assignable to type '(x: { a: string; b: number; }) => Object'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'. @@ -143,7 +143,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var b6: (x: (arg: T) => U) => T; a6 = b6; // ok b6 = a6; // ok @@ -152,7 +152,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b7: (x: (arg: T) => U) => (r: T) => U; a7 = b7; // ok b7 = a7; // ok @@ -161,7 +161,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; a8 = b8; // ok b8 = a8; // ok @@ -170,7 +170,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b9: (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; a9 = b9; // ok b9 = a9; // ok @@ -179,14 +179,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: (...x: T[]) => T; a10 = b10; // ok b10 = a10; // ok ~~~ !!! error TS2322: Type '(...x: Derived[]) => Derived' is not assignable to type '(...x: T[]) => T'. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. -!!! error TS2322: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. var b11: (x: T, y: T) => T; a11 = b11; // ok b11 = a11; // ok @@ -211,7 +211,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '(x: Base[], y: T) => T'. !!! error TS2322: Type 'Derived[]' is not assignable to type 'T'. -!!! error TS2322: 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. +!!! error TS2322: 'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. var b14: (x: { a: T; b: T }) => T; a14 = b14; // ok ~~~ diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt index 54c9b08e2cf7e..ecc1dbd848f99 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(52,9): error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. Types of parameters 'arg2' and 'arg2' are incompatible. @@ -16,7 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(58,9): error TS2322: Type '(...x: Base[]) => Base' is not assignable to type '(...x: T[]) => T'. Type 'Base' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(62,9): error TS2322: Type '(x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type '(x: T, y: T) => T'. @@ -47,7 +47,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(89,9): error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(90,9): error TS2322: Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. Type 'T[]' is not assignable to type 'string[]'. Type 'T' is not assignable to type 'string'. @@ -57,7 +57,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(96,9): error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts (15 errors) ==== @@ -119,7 +119,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; a8 = b8; // error, { foo: number } and Base are incompatible @@ -136,7 +136,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: (...x: T[]) => T; @@ -211,7 +211,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b2 = a2; ~~ !!! error TS2322: Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. @@ -231,6 +231,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt index 5ef474c7bc505..d3bb6e0b2e262 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.errors.txt @@ -5,13 +5,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures5.ts(55,1): error TS2322: Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. Types of property 'b' are incompatible. Type 'V' is not assignable to type 'U'. - 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures5.ts(58,1): error TS2322: Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -81,7 +81,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var b15: (x: { a: U; b: V; }) => U[]; a15 = b15; // ok, T = U, T = V b15 = a15; // ok @@ -91,7 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. !!! error TS2322: Types of property 'b' are incompatible. !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. var b16: (x: { a: T; b: T }) => T[]; a15 = b16; // ok b15 = a16; // ok diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt index f21c5ee8f94cf..c26a01c3a5127 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures6.ts(42,1): error TS2322: Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: T; b: T; }) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -62,7 +62,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var b16: (x: { a: T; b: T }) => T[]; x.a16 = b16; b16 = x.a16; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt index 665e0e7d1fce5..52b7a9280a537 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt @@ -14,30 +14,30 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(62,1): error TS2322: Type 'new (x: (arg: Base) => Derived) => Base' is not assignable to type 'new (x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(65,1): error TS2322: Type 'new (x: (arg: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(68,1): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(71,1): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number; }) => U) => (r: T) => U'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(74,1): error TS2322: Type 'new (...x: Derived[]) => Derived' is not assignable to type 'new (...x: T[]) => T'. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(77,1): error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new (x: T, y: T) => T'. Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type '{ foo: string; bar: string; }'. @@ -49,7 +49,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type 'Base' is missing the following properties from type 'Derived2': baz, bar tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(83,1): error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new (x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. - 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. + 'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures3.ts(85,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T' is not assignable to type 'new (x: { a: string; b: number; }) => Object'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: string; b: number; }' is not assignable to type '{ a: string; b: string; }'. @@ -143,7 +143,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var b6: new (x: (arg: T) => U) => T; a6 = b6; // ok b6 = a6; // ok @@ -152,7 +152,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b7: new (x: (arg: T) => U) => (r: T) => U; a7 = b7; // ok b7 = a7; // ok @@ -161,7 +161,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: new (x: (arg: T) => U, y: (arg2: T) => U) => (r: T) => U; a8 = b8; // ok b8 = a8; // ok @@ -170,7 +170,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b9: new (x: (arg: T) => U, y: (arg2: { foo: string; bing: number }) => U) => (r: T) => U; a9 = b9; // ok b9 = a9; // ok @@ -179,14 +179,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: new (...x: T[]) => T; a10 = b10; // ok b10 = a10; // ok ~~~ !!! error TS2322: Type 'new (...x: Derived[]) => Derived' is not assignable to type 'new (...x: T[]) => T'. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. -!!! error TS2322: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. var b11: new (x: T, y: T) => T; a11 = b11; // ok b11 = a11; // ok @@ -211,7 +211,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new (x: Base[], y: T) => T'. !!! error TS2322: Type 'Derived[]' is not assignable to type 'T'. -!!! error TS2322: 'Derived[]' is assignable to the constraint of type 'Derived[]', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. +!!! error TS2322: 'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. var b14: new (x: { a: T; b: T }) => T; a14 = b14; // ok ~~~ diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index fcae017d6da7d..fb9ba55b5efcb 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(52,9): error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. Types of parameters 'arg2' and 'arg2' are incompatible. @@ -16,7 +16,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(58,9): error TS2322: Type 'new (...x: Base[]) => Base' is not assignable to type 'new (...x: T[]) => T'. Type 'Base' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(62,9): error TS2322: Type 'new (x: { foo: string; }, y: { foo: string; bar: string; }) => Base' is not assignable to type 'new (x: T, y: T) => T'. @@ -63,7 +63,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(89,9): error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(90,9): error TS2322: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. Type 'T[]' is not assignable to type 'string[]'. Type 'T' is not assignable to type 'string'. @@ -73,7 +73,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(96,9): error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (19 errors) ==== @@ -135,7 +135,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b8: new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U; a8 = b8; // error, type mismatch @@ -152,7 +152,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type 'T'. -!!! error TS2322: 'Base' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. var b10: new (...x: T[]) => T; @@ -247,7 +247,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b2 = a2; // ok ~~ !!! error TS2322: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. @@ -267,6 +267,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2322: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt index 2fd7217076fc4..bfd92f7e93004 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.errors.txt @@ -5,13 +5,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures5.ts(55,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. Types of property 'b' are incompatible. Type 'V' is not assignable to type 'U'. - 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures5.ts(58,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: U; b: V; }) => U[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: U; b: V; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -81,7 +81,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var b15: new (x: { a: U; b: V; }) => U[]; a15 = b15; // ok b15 = a15; // ok @@ -91,7 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ a: U; b: V; }' is not assignable to type '{ a: U; b: U; }'. !!! error TS2322: Types of property 'b' are incompatible. !!! error TS2322: Type 'V' is not assignable to type 'U'. -!!! error TS2322: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. var b16: new (x: { a: T; b: T }) => T[]; a15 = b16; // ok b15 = a16; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt index f73d7fd9d32f5..1397dfe528b1f 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. Types of property 'foo' are incompatible. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures6.ts(42,1): error TS2322: Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: T; b: T; }) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: Base; b: Base; }'. @@ -62,7 +62,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ foo: U; bar: U; }' is not assignable to type '{ foo: T; bar: T; }'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var b16: new (x: { a: T; b: T }) => T[]; x.a16 = b16; b16 = x.a16; diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt index 7d7da35a1200d..adf305d868d19 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignatures2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures2.ts(15,1): error TS2322: Type 'B' is not assignable to type 'A'. Types of parameters 'y' and 'y' are incompatible. Type 'T[]' is not assignable to type 'T'. - 'T[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignatures2.ts(16,1): error TS2322: Type 'A' is not assignable to type 'B'. Types of parameters 'y' and 'y' are incompatible. Type 'S' is not assignable to type 'S[]'. @@ -27,7 +27,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type 'B' is not assignable to type 'A'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T[]' is not assignable to type 'T'. -!!! error TS2322: 'T[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b = a; ~ !!! error TS2322: Type 'A' is not assignable to type 'B'. diff --git a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt index 3705c3b6ab2b9..d5b212a414a9c 100644 --- a/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -2,91 +2,91 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(23,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(63,9): error TS2322: Type '() => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(64,9): error TS2322: Type '(x?: T) => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(65,9): error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(66,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(67,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(69,9): error TS2322: Type '() => T' is not assignable to type '(x?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(70,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(71,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(72,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(73,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(75,9): error TS2322: Type '() => T' is not assignable to type '(x: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(76,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(77,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(78,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(79,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(81,9): error TS2322: Type '() => T' is not assignable to type '(x: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(82,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(83,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(84,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(85,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(87,9): error TS2322: Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(88,9): error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(89,9): error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(90,9): error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(91,9): error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(107,13): error TS2322: Type '(x: T) => any' is not assignable to type '() => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts(116,13): error TS2322: Type '(x: T, y: T) => any' is not assignable to type '(x: T) => T'. @@ -162,12 +162,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type '() => T' is not assignable to type '() => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a = t.a2; ~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '() => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a = t.a3; ~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '() => T'. @@ -178,127 +178,127 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '() => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a2 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a3 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a4 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a; ~~~~ !!! error TS2322: Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a2; ~~~~ !!! error TS2322: Type '(x?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a3; ~~~~ !!! error TS2322: Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a4; ~~~~ !!! error TS2322: Type '(x: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. b.a5 = t.a5; ~~~~ !!! error TS2322: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } } diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt index 835c6b3ee8a22..7358455430c80 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -15,7 +15,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -68,7 +68,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. -!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b = a; // error ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. @@ -82,7 +82,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b2 = a; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt index 0f25602abf9ed..f4b2e46f44f96 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(33,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -15,7 +15,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(36,9): error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -68,7 +68,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. -!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b = a; // error ~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived; }'. @@ -82,7 +82,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b2 = a; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt index 291262932b00e..1f279ba2858f7 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts(33,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithNumericIndexer3.ts (3 errors) ==== @@ -58,7 +58,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. -!!! error TS2322: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. b = a; // ok var b2: { [x: number]: T; }; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt index 34ba4da56b811..b3970325dc298 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt @@ -13,7 +13,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -21,7 +21,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -96,7 +96,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. -!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b3 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. @@ -110,7 +110,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b4 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt index 70e550008a189..f90f8a41feb05 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt @@ -13,7 +13,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(47,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived'. @@ -21,7 +21,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(50,9): error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. Index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. @@ -96,7 +96,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived' is not assignable to type 'T'. -!!! error TS2322: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b3 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. @@ -110,7 +110,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Type '{ [x: string]: Derived2; }' is not assignable to type 'A'. !!! error TS2322: Index signatures are incompatible. !!! error TS2322: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2322: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2322: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. b4 = a3; // error ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. diff --git a/tests/baselines/reference/assignmentStricterConstraints.errors.txt b/tests/baselines/reference/assignmentStricterConstraints.errors.txt index f54e852a46826..f00b8313eac8d 100644 --- a/tests/baselines/reference/assignmentStricterConstraints.errors.txt +++ b/tests/baselines/reference/assignmentStricterConstraints.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/assignmentStricterConstraints.ts(7,1): error TS2322: Type '(x: T, y: S) => void' is not assignable to type '(x: T, y: S) => void'. Types of parameters 'y' and 'y' are incompatible. Type 'S' is not assignable to type 'T'. - 'S' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'S' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/assignmentStricterConstraints.ts (1 errors) ==== @@ -16,6 +16,6 @@ tests/cases/compiler/assignmentStricterConstraints.ts(7,1): error TS2322: Type ' !!! error TS2322: Type '(x: T, y: S) => void' is not assignable to type '(x: T, y: S) => void'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'S' is not assignable to type 'T'. -!!! error TS2322: 'S' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'S' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. g(1, "") \ No newline at end of file diff --git a/tests/baselines/reference/baseConstraintOfDecorator.errors.txt b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt index 1a498f3cc3b26..8317e5c55c660 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.errors.txt +++ b/tests/baselines/reference/baseConstraintOfDecorator.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/baseConstraintOfDecorator.ts(2,5): error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. - 'typeof decoratorFunc' is assignable to the constraint of type '{}', but 'TFunction' could be instantiated with a different subtype of constraint '{}'. + 'typeof decoratorFunc' is assignable to the constraint of type 'TFunction', but 'TFunction' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/baseConstraintOfDecorator.ts(2,40): error TS2507: Type 'TFunction' is not a constructor function type. tests/cases/compiler/baseConstraintOfDecorator.ts(12,5): error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. tests/cases/compiler/baseConstraintOfDecorator.ts(12,40): error TS2507: Type 'TFunction' is not a constructor function type. @@ -23,7 +23,7 @@ tests/cases/compiler/baseConstraintOfDecorator.ts(12,40): error TS2507: Type 'TF }; ~~~~~~ !!! error TS2322: Type 'typeof decoratorFunc' is not assignable to type 'TFunction'. -!!! error TS2322: 'typeof decoratorFunc' is assignable to the constraint of type '{}', but 'TFunction' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'typeof decoratorFunc' is assignable to the constraint of type 'TFunction', but 'TFunction' could be instantiated with a different subtype of constraint '{}'. } class MyClass { private x; } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt index d8db30bbe7094..2ca3bb1aaf00a 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Types of property 'a2' are incompatible. Type '(x: T) => string' is not assignable to type '(x: T) => T'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance.ts (2 errors) ==== @@ -83,7 +83,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: T) => string' is not assignable to type '(x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt index d44708895a32e..671c09b3d7906 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(60,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. @@ -31,7 +31,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(109,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'. Types of property 'a2' are incompatible. Type '(x: T) => T[]' is not assignable to type '(x: T) => string[]'. @@ -97,7 +97,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'number' is not assignable to type 'T'. -!!! error TS2430: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -178,7 +178,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => string[]' is not assignable to type '(x: T) => T[]'. !!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => string[]; // error } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt index 8869a60c1099e..f6526347975c7 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.errors.txt @@ -3,32 +3,32 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '(x: T) => T[]' is not assignable to type '(x: T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(28,11): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type '(x: T) => string[]' is not assignable to type '(x: T) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(32,11): error TS2430: Interface 'I3' incorrectly extends interface 'A'. Types of property 'a3' are incompatible. Type '(x: T) => T' is not assignable to type '(x: T) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(36,11): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a4' are incompatible. Type '(x: T, y: U) => string' is not assignable to type '(x: T, y: U) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(40,11): error TS2430: Interface 'I5' incorrectly extends interface 'A'. Types of property 'a5' are incompatible. Type '(x: (arg: T) => U) => T' is not assignable to type '(x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(44,11): error TS2430: Interface 'I7' incorrectly extends interface 'A'. Types of property 'a11' are incompatible. Type '(x: { foo: T; }, y: { foo: U; bar: U; }) => Base' is not assignable to type '(x: { foo: T; }, y: { foo: T; bar: T; }) => Base'. @@ -36,7 +36,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'foo' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts(48,11): error TS2430: Interface 'I9' incorrectly extends interface 'A'. Types of property 'a16' are incompatible. Type '(x: { a: T; b: T; }) => T[]' is not assignable to type '(x: { a: T; b: T; }) => T[]'. @@ -44,9 +44,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'a' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts (7 errors) ==== @@ -80,7 +80,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => T[]' is not assignable to type '(x: T) => T[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: (x: T) => T[]; } @@ -91,7 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => string[]' is not assignable to type '(x: T) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => string[]; } @@ -102,7 +102,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x: T) => void'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: (x: T) => T; } @@ -113,7 +113,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '(x: T, y: U) => string' is not assignable to type '(x: T, y: U) => string'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x: T, y: U) => string; } @@ -125,7 +125,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x: (arg: T) => U) => T; } @@ -138,7 +138,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'foo' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a11: (x: { foo: T }, y: { foo: U; bar: U }) => Base; } @@ -151,8 +151,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! error TS2430: Type 'Base' is not assignable to type 'T'. -!!! error TS2430: 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a16: (x: { a: T; b: T }) => T[]; } \ No newline at end of file diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt index 115fce7ff6ef4..e0091e407dfc5 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(7,49): error TS2322: Type 'T' is not assignable to type 'S'. - 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'S', but 'S' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,35): error TS2322: Type 'T' is not assignable to type 'S'. - 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'S', but 'S' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type '""' is not assignable to type 'number'. @@ -17,14 +17,14 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete (new Chain(t)).then(tt => s).then(ss => t); ~ !!! error TS2322: Type 'T' is not assignable to type 'S'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'S', but 'S' could be instantiated with a different subtype of constraint '{}'. !!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:3:27: The expected type comes from the return type of this signature. // But error to try to climb up the chain (new Chain(s)).then(ss => t); ~ !!! error TS2322: Type 'T' is not assignable to type 'S'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'S' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'S', but 'S' could be instantiated with a different subtype of constraint '{}'. !!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts:3:27: The expected type comes from the return type of this signature. // Staying at T or S should be fine diff --git a/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt b/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt index 3e5d8774007a5..d2c8c0111aede 100644 --- a/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt +++ b/tests/baselines/reference/commaOperatorOtherInvalidOperation.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(6,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts(12,9): error TS2322: Type 'T2' is not assignable to type 'T1'. - 'T2' is assignable to the constraint of type '{}', but 'T1' could be instantiated with a different subtype of constraint '{}'. + 'T2' is assignable to the constraint of type 'T1', but 'T1' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOperation.ts (2 errors) ==== @@ -20,5 +20,5 @@ tests/cases/conformance/expressions/commaOperator/commaOperatorOtherInvalidOpera var result: T1 = (x, y); //error here ~~~~~~ !!! error TS2322: Type 'T2' is not assignable to type 'T1'. -!!! error TS2322: 'T2' is assignable to the constraint of type '{}', but 'T1' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T2' is assignable to the constraint of type 'T1', but 'T1' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/complexRecursiveCollections.errors.txt b/tests/baselines/reference/complexRecursiveCollections.errors.txt index ea96208f770b0..27bb24bc5cc14 100644 --- a/tests/baselines/reference/complexRecursiveCollections.errors.txt +++ b/tests/baselines/reference/complexRecursiveCollections.errors.txt @@ -2,17 +2,17 @@ tests/cases/compiler/immutable.ts(341,22): error TS2430: Interface 'Keyed' Types of property 'toSeq' are incompatible. Type '() => Keyed' is not assignable to type '() => this'. Type 'Keyed' is not assignable to type 'this'. - 'Keyed' is assignable to the constraint of type 'Keyed', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. + 'Keyed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. tests/cases/compiler/immutable.ts(359,22): error TS2430: Interface 'Indexed' incorrectly extends interface 'Collection'. Types of property 'toSeq' are incompatible. Type '() => Indexed' is not assignable to type '() => this'. Type 'Indexed' is not assignable to type 'this'. - 'Indexed' is assignable to the constraint of type 'Indexed', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. + 'Indexed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' incorrectly extends interface 'Collection'. Types of property 'toSeq' are incompatible. Type '() => Set' is not assignable to type '() => this'. Type 'Set' is not assignable to type 'this'. - 'Set' is assignable to the constraint of type 'Set', but 'this' could be instantiated with a different subtype of constraint 'Set'. + 'Set' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set'. ==== tests/cases/compiler/complex.ts (0 errors) ==== @@ -383,7 +383,7 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco !!! error TS2430: Types of property 'toSeq' are incompatible. !!! error TS2430: Type '() => Keyed' is not assignable to type '() => this'. !!! error TS2430: Type 'Keyed' is not assignable to type 'this'. -!!! error TS2430: 'Keyed' is assignable to the constraint of type 'Keyed', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. +!!! error TS2430: 'Keyed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Keyed'. toJS(): Object; toJSON(): { [key: string]: V }; toSeq(): Seq.Keyed; @@ -407,7 +407,7 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco !!! error TS2430: Types of property 'toSeq' are incompatible. !!! error TS2430: Type '() => Indexed' is not assignable to type '() => this'. !!! error TS2430: Type 'Indexed' is not assignable to type 'this'. -!!! error TS2430: 'Indexed' is assignable to the constraint of type 'Indexed', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. +!!! error TS2430: 'Indexed' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Indexed'. toJS(): Array; toJSON(): Array; // Reading values @@ -445,7 +445,7 @@ tests/cases/compiler/immutable.ts(391,22): error TS2430: Interface 'Set' inco !!! error TS2430: Types of property 'toSeq' are incompatible. !!! error TS2430: Type '() => Set' is not assignable to type '() => this'. !!! error TS2430: Type 'Set' is not assignable to type 'this'. -!!! error TS2430: 'Set' is assignable to the constraint of type 'Set', but 'this' could be instantiated with a different subtype of constraint 'Set'. +!!! error TS2430: 'Set' is assignable to the constraint of type 'this', but 'this' could be instantiated with a different subtype of constraint 'Set'. toJS(): Array; toJSON(): Array; toSeq(): Seq.Set; diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index b264943475e74..c84ce90642a3a 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -14,9 +14,9 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(30,9): error TS23 Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'Pick' is not assignable to type 'T'. - 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Pick' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick' is not assignable to type 'T'. - 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Pick' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. Type 'keyof T' is not assignable to type 'never'. @@ -42,14 +42,14 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(135,5): error TS2 tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a read-only property. tests/cases/conformance/types/conditional/conditionalTypes1.ts(137,10): error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2322: Type 'ZeroOf' is not assignable to type 'T'. - 'ZeroOf' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. Type '0' is not assignable to type 'T'. - '0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type '"" | 0' is not assignable to type 'T'. - '"" | 0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. Type '""' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. + '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. Type 'string' is not assignable to type 'ZeroOf'. @@ -185,11 +185,11 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS x = y; // Error ~ !!! error TS2322: Type 'Pick' is not assignable to type 'T'. -!!! error TS2322: 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Pick' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. x = z; // Error ~ !!! error TS2322: Type 'Pick' is not assignable to type 'T'. -!!! error TS2322: 'Pick' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Pick' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; y = z; // Error ~ @@ -281,14 +281,14 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS x = y; // Error ~ !!! error TS2322: Type 'ZeroOf' is not assignable to type 'T'. -!!! error TS2322: 'ZeroOf' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: 'ZeroOf' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. !!! error TS2322: Type '0' is not assignable to type 'T'. -!!! error TS2322: '0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: '0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type '"" | 0' is not assignable to type 'T'. -!!! error TS2322: '"" | 0' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: '"" | 0' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. !!! error TS2322: Type '""' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'string | number', but 'T' could be instantiated with a different subtype of constraint 'string | number'. +!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'. y = x; // Error ~ !!! error TS2322: Type 'T' is not assignable to type 'ZeroOf'. diff --git a/tests/baselines/reference/conditionalTypes2.errors.txt b/tests/baselines/reference/conditionalTypes2.errors.txt index 33c942dc70108..1f930fe3bbf48 100644 --- a/tests/baselines/reference/conditionalTypes2.errors.txt +++ b/tests/baselines/reference/conditionalTypes2.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(15,5): error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. Type 'A' is not assignable to type 'B'. - 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. + 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(19,5): error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. Type 'A' is not assignable to type 'B'. - 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. + 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(24,5): error TS2322: Type 'Invariant' is not assignable to type 'Invariant'. Types of property 'foo' are incompatible. Type 'B extends string ? keyof B : B' is not assignable to type 'A extends string ? keyof A : A'. @@ -21,7 +21,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(25,5): error TS23 Types of property 'foo' are incompatible. Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'. Type 'A' is not assignable to type 'B'. - 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. + 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/conditional/conditionalTypes2.ts(73,12): error TS2345: Argument of type 'Extract, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'. Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'. Type 'Extract' is not assignable to type '{ foo: string; bat: string; }'. @@ -52,7 +52,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 ~ !!! error TS2322: Type 'Covariant' is not assignable to type 'Covariant'. !!! error TS2322: Type 'A' is not assignable to type 'B'. -!!! error TS2322: 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint '{}'. } function f2(a: Contravariant, b: Contravariant) { @@ -60,7 +60,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 ~ !!! error TS2322: Type 'Contravariant' is not assignable to type 'Contravariant'. !!! error TS2322: Type 'A' is not assignable to type 'B'. -!!! error TS2322: 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint '{}'. b = a; } @@ -86,7 +86,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2 !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'A extends string ? keyof A : A' is not assignable to type 'B extends string ? keyof B : B'. !!! error TS2322: Type 'A' is not assignable to type 'B'. -!!! error TS2322: 'A' is assignable to the constraint of type '{}', but 'B' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint '{}'. } // Extract is a T that is known to be a Function diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt index 565c9fbf1b942..e326d163c8ced 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Types of property 'a2' are incompatible. Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance.ts (2 errors) ==== @@ -87,7 +87,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: new (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt index e65e974b4fac7..59d8105c59cc9 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(50,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. @@ -31,7 +31,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. Type 'string[]' is not assignable to type 'T[]'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(95,19): error TS2430: Interface 'I7' incorrectly extends interface 'C'. Types of property 'a2' are incompatible. Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => string[]'. @@ -87,7 +87,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'number' is not assignable to type 'T'. -!!! error TS2430: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -164,7 +164,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2430: Type 'string[]' is not assignable to type 'T[]'. !!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => string[]; // error } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt index c87f14b12bc66..a2ea2c70c65ee 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.errors.txt @@ -3,32 +3,32 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(28,11): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(32,11): error TS2430: Interface 'I3' incorrectly extends interface 'A'. Types of property 'a3' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(36,11): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a4' are incompatible. Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(40,11): error TS2430: Interface 'I5' incorrectly extends interface 'A'. Types of property 'a5' are incompatible. Type 'new (x: (arg: T) => U) => T' is not assignable to type 'new (x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(44,11): error TS2430: Interface 'I7' incorrectly extends interface 'A'. Types of property 'a11' are incompatible. Type 'new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base' is not assignable to type 'new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base'. @@ -36,7 +36,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'foo' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts(48,11): error TS2430: Interface 'I9' incorrectly extends interface 'A'. Types of property 'a16' are incompatible. Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: T; b: T; }) => T[]'. @@ -44,9 +44,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'a' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts (7 errors) ==== @@ -80,7 +80,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new (x: T) => T[]; } @@ -91,7 +91,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => string[]; } @@ -102,7 +102,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x: T) => T; } @@ -113,7 +113,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T, y: U) => string; } @@ -125,7 +125,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: (arg: T) => U) => T; } @@ -138,7 +138,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'foo' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; } @@ -151,8 +151,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! error TS2430: Type 'Base' is not assignable to type 'T'. -!!! error TS2430: 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a16: new (x: { a: T; b: T }) => T[]; } \ No newline at end of file diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt index 3a24a78553e7d..38fadde8f5b99 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt @@ -1,10 +1,10 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type '1' is not assignable to type 'string'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2322: Type 'Date' is not assignable to type 'T'. - 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. ==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts (4 errors) ==== @@ -22,10 +22,10 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T = 1, public y: U = x) { // error ~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'T'. -!!! error TS2322: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ~~~~~~~~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. var z = x; } } @@ -35,7 +35,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorParameters/co constructor(x: T = new Date()) { // error ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'Date' is not assignable to type 'T'. -!!! error TS2322: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2322: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var y = x; } } \ No newline at end of file diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index f142045702434..499b31460b7dc 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class. tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,18): error TS2322: Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts (4 errors) ==== @@ -40,7 +40,7 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class. ~ !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! related TS6500 tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts:24:5: The expected type comes from property 'x' which is declared here on type 'F' } } diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index d45d816876b72..e63849e4aa887 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -3,9 +3,9 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type '""' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. + '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type '""' is not assignable to type 'T'. - '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. + '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'number'. @@ -52,12 +52,12 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. foo(): T { return ''; // error ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'T'. -!!! error TS2322: '""' is assignable to the constraint of type 'string', but 'T' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: '""' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string'. } } diff --git a/tests/baselines/reference/enumAssignability.errors.txt b/tests/baselines/reference/enumAssignability.errors.txt index 01045b53aa006..b582f9f8048ce 100644 --- a/tests/baselines/reference/enumAssignability.errors.txt +++ b/tests/baselines/reference/enumAssignability.errors.txt @@ -14,14 +14,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(43,9): error TS2322: Type 'E' is not assignable to type '(x: T) => T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(45,9): error TS2322: Type 'E' is not assignable to type 'String'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(48,9): error TS2322: Type 'E' is not assignable to type 'T'. - 'E' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'E' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(49,9): error TS2322: Type 'E' is not assignable to type 'U'. - 'E' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'E' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(50,9): error TS2322: Type 'E' is not assignable to type 'V'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(51,13): error TS2322: Type 'E' is not assignable to type 'A'. - 'E' is assignable to the constraint of type 'Number', but 'A' could be instantiated with a different subtype of constraint 'Number'. + 'E' is assignable to the constraint of type 'A', but 'A' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(52,13): error TS2322: Type 'E' is not assignable to type 'B'. - 'E' is assignable to the constraint of type 'E', but 'B' could be instantiated with a different subtype of constraint 'E'. + 'E' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint 'E'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts (20 errors) ==== @@ -105,21 +105,21 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi x = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'T'. -!!! error TS2322: 'E' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'E' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'U'. -!!! error TS2322: 'E' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'E' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. z = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'V'. var a: A = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'A'. -!!! error TS2322: 'E' is assignable to the constraint of type 'Number', but 'A' could be instantiated with a different subtype of constraint 'Number'. +!!! error TS2322: 'E' is assignable to the constraint of type 'A', but 'A' could be instantiated with a different subtype of constraint 'Number'. var b: B = e; ~ !!! error TS2322: Type 'E' is not assignable to type 'B'. -!!! error TS2322: 'E' is assignable to the constraint of type 'E', but 'B' could be instantiated with a different subtype of constraint 'E'. +!!! error TS2322: 'E' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint 'E'. } } \ No newline at end of file diff --git a/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt b/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt index 6727be14e02ed..6cfeeb8aeb816 100644 --- a/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt +++ b/tests/baselines/reference/errorElaborationDivesIntoApparentlyPresentPropsOnly.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(2,5): error TS2322: Type '{ a: string; b: number; c: number; }' is not assignable to type 'T'. tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(6,5): error TS2322: Type '{ a: number; }' is not assignable to type 'T'. tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(10,5): error TS2322: Type '{ a: string; }' is not assignable to type 'T'. - '{ a: string; }' is assignable to the constraint of type '{ a: string; }', but 'T' could be instantiated with a different subtype of constraint '{ a: string; }'. + '{ a: string; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ a: string; }'. ==== tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts (3 errors) ==== @@ -21,6 +21,6 @@ tests/cases/compiler/errorElaborationDivesIntoApparentlyPresentPropsOnly.ts(10,5 x = { a: "not ok" }; ~ !!! error TS2322: Type '{ a: string; }' is not assignable to type 'T'. -!!! error TS2322: '{ a: string; }' is assignable to the constraint of type '{ a: string; }', but 'T' could be instantiated with a different subtype of constraint '{ a: string; }'. +!!! error TS2322: '{ a: string; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ a: string; }'. } \ No newline at end of file diff --git a/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt b/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt index 5d9188fe5c721..2ca7218764a00 100644 --- a/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt +++ b/tests/baselines/reference/errorMessagesIntersectionTypes03.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/errorMessagesIntersectionTypes03.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'T'. - 'A & B' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'A & B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'U'. - 'A & B' is assignable to the constraint of type 'A', but 'U' could be instantiated with a different subtype of constraint 'A'. + 'A & B' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'V'. - 'A & B' is assignable to the constraint of type 'A', but 'V' could be instantiated with a different subtype of constraint 'A'. + 'A & B' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(22,5): error TS2322: Type 'T & B' is not assignable to type 'U'. tests/cases/compiler/errorMessagesIntersectionTypes03.ts(23,5): error TS2322: Type 'T & B' is not assignable to type 'V'. @@ -28,15 +28,15 @@ tests/cases/compiler/errorMessagesIntersectionTypes03.ts(23,5): error TS2322: Ty t = a_and_b; ~ !!! error TS2322: Type 'A & B' is not assignable to type 'T'. -!!! error TS2322: 'A & B' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'A & B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. u = a_and_b; ~ !!! error TS2322: Type 'A & B' is not assignable to type 'U'. -!!! error TS2322: 'A & B' is assignable to the constraint of type 'A', but 'U' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'A & B' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'A'. v = a_and_b; ~ !!! error TS2322: Type 'A & B' is not assignable to type 'V'. -!!! error TS2322: 'A & B' is assignable to the constraint of type 'A', but 'V' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'A & B' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint 'A'. t = t_and_b; u = t_and_b; diff --git a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt index 06d9eb0778a32..f2f59225ca3f5 100644 --- a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt +++ b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts(9,1): error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. Type '{}[]' is not assignable to type 'T'. - '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '{}[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts (1 errors) ==== @@ -16,7 +16,7 @@ tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts(9,1): error TS2322: ~ !!! error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. !!! error TS2322: Type '{}[]' is not assignable to type 'T'. -!!! error TS2322: '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: '{}[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var s = f("str").toUpperCase(); console.log(s); diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt index ef3fceb4ce434..16f2e47a1b951 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.errors.txt @@ -3,15 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(30,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(33,23): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(34,24): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments.ts(35,23): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -54,7 +54,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r10 = foo2(1, (x) => ''); // string var r11 = foo3(1, (x: T) => '', ''); // error @@ -62,13 +62,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r11b = foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r12 = foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index eb382ecc63218..c308e16c224c0 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -2,14 +2,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen Types of parameters 'x' and 'x' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. - 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. Type 'Date' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,43): error TS2322: Type 'F' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. - 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. Types of parameters 'a' and 'x' are incompatible. @@ -40,7 +40,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r9 = r7(new Date()); // should be ok ~~~~~~~~~~ !!! error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. -!!! error TS2345: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); // error ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. @@ -87,7 +87,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r9 = r7(new Date()); ~~~~~~~~~~ !!! error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. -!!! error TS2345: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2345: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. var r10 = r7(1); ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt index b9fe141b174d7..1f4db6be557b7 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints4.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(19,17): error TS2345: Argument of type 'C' is not assignable to parameter of type 'D'. Property 'y' is missing in type 'C' but required in type 'D'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts(30,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. - 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints4.ts (2 errors) ==== @@ -41,7 +41,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r5 = foo(c, d); // error ~ !!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. -!!! error TS2345: 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt index 63276780a1959..df3b228bf059d 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints5.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(19,23): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. Type 'void' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts(22,24): error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. - 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts (3 errors) ==== @@ -38,6 +38,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj var r5 = foo(c, d); // error ~ !!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'T'. -!!! error TS2345: 'C' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt index 39a65dab4e535..1e3e2466ed3f0 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndInitializers.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(5,33): error TS2322: Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type 'Number', but 'T' could be instantiated with a different subtype of constraint 'Number'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(6,37): error TS2322: Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'. - 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. Type 'T' is not assignable to type 'V'. - 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts (3 errors) ==== @@ -16,16 +16,16 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC function foo3(x: T = 1) { } // error ~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'T'. -!!! error TS2322: '1' is assignable to the constraint of type 'Number', but 'T' could be instantiated with a different subtype of constraint 'Number'. +!!! error TS2322: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Number'. function foo4(x: T, y: U = x) { } // error ~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. function foo5(x: U, y: T = x) { } // ok function foo6(x: T, y: U, z: V = y) { } // error ~~~~~~~~ !!! error TS2322: Type 'U' is not assignable to type 'V'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. !!! error TS2322: Type 'T' is not assignable to type 'V'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'V' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint '{}'. function foo7(x: V, y: U = x) { } // should be ok \ No newline at end of file diff --git a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt index 6c50f01c9ebae..26f97751caaf8 100644 --- a/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt +++ b/tests/baselines/reference/genericCallbackInvokedInsideItsContainingFunction1.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(12,17): error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(13,17): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17): error TS2558: Expected 0 type arguments, but got 1. @@ -18,7 +18,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 var r2 = f(1); ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r3 = f(null); ~~~ !!! error TS2558: Expected 0 type arguments, but got 1. @@ -36,7 +36,7 @@ tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17 var r12 = f(y); ~ !!! error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'. -!!! error TS2345: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r22 = f(y); ~~~~~~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt index 2c4050df69d7c..5366fbc9aeb32 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(57,29): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(60,30): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(61,31): error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. Types of parameters 'x' and 'a' are incompatible. Type '1' is not assignable to type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFunctionTypedMemberArguments.ts(62,30): error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. Type 'string' is not assignable to type '1'. @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r10 = c.foo2(1, (x) => ''); // string var r11 = c3.foo3(1, (x: T) => '', ''); // error @@ -84,13 +84,13 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericClassWithFu !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r11b = c3.foo3(1, (x: T) => '', 1); // error ~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: T) => string' is not assignable to parameter of type '(a: 1) => string'. !!! error TS2345: Types of parameters 'x' and 'a' are incompatible. !!! error TS2345: Type '1' is not assignable to type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var r12 = c3.foo3(1, function (a) { return '' }, 1); // error ~~~~~~~~ !!! error TS2345: Argument of type '(a: number) => string' is not assignable to parameter of type '(a: number) => 1'. diff --git a/tests/baselines/reference/genericDefaultsErrors.errors.txt b/tests/baselines/reference/genericDefaultsErrors.errors.txt index e7dcfd83dea7a..91d4d608f1aef 100644 --- a/tests/baselines/reference/genericDefaultsErrors.errors.txt +++ b/tests/baselines/reference/genericDefaultsErrors.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(4,59): error TS2344: Type 'T' does Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericDefaultsErrors.ts(5,44): error TS2344: Type 'T' does not satisfy the constraint 'number'. tests/cases/compiler/genericDefaultsErrors.ts(6,39): error TS2344: Type 'number' does not satisfy the constraint 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericDefaultsErrors.ts(10,5): error TS2558: Expected 2-3 type arguments, but got 1. tests/cases/compiler/genericDefaultsErrors.ts(13,5): error TS2558: Expected 2-3 type arguments, but got 4. tests/cases/compiler/genericDefaultsErrors.ts(17,13): error TS2345: Argument of type '"a"' is not assignable to parameter of type 'number'. @@ -17,7 +17,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(27,52): error TS2344: Type 'T' doe Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericDefaultsErrors.ts(28,37): error TS2344: Type 'T' does not satisfy the constraint 'number'. tests/cases/compiler/genericDefaultsErrors.ts(29,32): error TS2344: Type 'number' does not satisfy the constraint 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericDefaultsErrors.ts(32,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(33,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. tests/cases/compiler/genericDefaultsErrors.ts(36,15): error TS2707: Generic type 'i09' requires between 2 and 3 type arguments. @@ -42,7 +42,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,29): error TS2716: Type paramet declare function f06(): void; // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'T'. -!!! error TS2344: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2344: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. declare function f11(): void; f11(); // ok @@ -91,7 +91,7 @@ tests/cases/compiler/genericDefaultsErrors.ts(42,29): error TS2716: Type paramet interface i08 { } // error ~~~~~~ !!! error TS2344: Type 'number' does not satisfy the constraint 'T'. -!!! error TS2344: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2344: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. interface i09 { } type i09t00 = i09; // error diff --git a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt index 870fea3e2dd56..33858a86b0c74 100644 --- a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt +++ b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts(6,1): error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. Type '{}[]' is not assignable to type 'T'. - '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '{}[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts (1 errors) ==== @@ -13,7 +13,7 @@ tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts(6,1): err ~ !!! error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. !!! error TS2322: Type '{}[]' is not assignable to type 'T'. -!!! error TS2322: '{}[]' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: '{}[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var s = f("str").toUpperCase(); diff --git a/tests/baselines/reference/genericTypeAssertions4.errors.txt b/tests/baselines/reference/genericTypeAssertions4.errors.txt index 45bb38616cec1..6a74d8fe26513 100644 --- a/tests/baselines/reference/genericTypeAssertions4.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions4.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/genericTypeAssertions4.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. - 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'A' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. - 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. - 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(23,9): error TS2352: Conversion of type 'B' 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. - 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Conversion of type 'C' 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. - 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. ==== tests/cases/compiler/genericTypeAssertions4.ts (5 errors) ==== @@ -32,22 +32,22 @@ tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Conversion o y = a; // error: cannot convert A to T ~ !!! error TS2322: Type 'A' is not assignable to type 'T'. -!!! error TS2322: 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'A' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = b; // error: cannot convert B to T ~ !!! error TS2322: Type 'B' is not assignable to type 'T'. -!!! error TS2322: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~ !!! error TS2322: Type 'C' is not assignable to type 'T'. -!!! error TS2322: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = a; y = b; // error: cannot convert B to T ~~~~ !!! error TS2352: Conversion of type 'B' 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: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2352: 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~~~~ !!! error TS2352: Conversion of type 'C' 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: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2352: 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions5.errors.txt b/tests/baselines/reference/genericTypeAssertions5.errors.txt index 43ac1ac942b0e..d2eea8157aa60 100644 --- a/tests/baselines/reference/genericTypeAssertions5.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions5.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/genericTypeAssertions5.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. - 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'A' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. - 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. - 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(23,9): error TS2352: Conversion of type 'B' 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. - 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Conversion of type 'C' 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. - 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. + 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. ==== tests/cases/compiler/genericTypeAssertions5.ts (5 errors) ==== @@ -32,22 +32,22 @@ tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Conversion o y = a; // error: cannot convert A to T ~ !!! error TS2322: Type 'A' is not assignable to type 'T'. -!!! error TS2322: 'A' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'A' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = b; // error: cannot convert B to T ~ !!! error TS2322: Type 'B' is not assignable to type 'T'. -!!! error TS2322: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~ !!! error TS2322: Type 'C' is not assignable to type 'T'. -!!! error TS2322: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2322: 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = a; y = b; // error: cannot convert B to T ~~~~ !!! error TS2352: Conversion of type 'B' 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: 'B' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2352: 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. y = c; // error: cannot convert C to T ~~~~ !!! error TS2352: Conversion of type 'C' 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: 'C' is assignable to the constraint of type 'A', but 'T' could be instantiated with a different subtype of constraint 'A'. +!!! error TS2352: 'C' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'A'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions6.errors.txt b/tests/baselines/reference/genericTypeAssertions6.errors.txt index 624f1ef62cbc9..9aeebcf11b12a 100644 --- a/tests/baselines/reference/genericTypeAssertions6.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions6.errors.txt @@ -1,11 +1,11 @@ tests/cases/compiler/genericTypeAssertions6.ts(8,13): 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 '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Conversion of type 'T' to type 'U' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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) ==== @@ -19,11 +19,11 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Conversion x = y; ~~~~ !!! 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 '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2352: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; ~~~~ !!! error TS2352: Conversion of type 'T' to type 'U' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -!!! error TS2352: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2352: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } } @@ -36,9 +36,9 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Conversion var e = new Date(); ~~~~~~~~~~~~~~~~ !!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2352: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. } } diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt index 5b9daadc9716e..fe1aaf3f8de08 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(7,40): error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. - '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/genericWithOpenTypeParameters1.ts(8,41): error TS2558: Expected 0 type arguments, but got 1. tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expected 0 type arguments, but got 1. @@ -14,7 +14,7 @@ tests/cases/compiler/genericWithOpenTypeParameters1.ts(9,41): error TS2558: Expe var f = (x: B) => { return x.foo(1); } // error ~ !!! error TS2345: Argument of type '1' is not assignable to parameter of type 'T'. -!!! error TS2345: '1' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2345: '1' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. var f2 = (x: B) => { return x.foo(1); } // error ~ !!! error TS2558: Expected 0 type arguments, but got 1. diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt index bf3703fa787be..12770e4ca0ee0 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (5 errors) ==== @@ -28,7 +28,7 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A' is not assignable to type 'A'. !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } } diff --git a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt index 0cecab1f92fe7..3174290c6ab51 100644 --- a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt +++ b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(8,5): error TS2416: tests/cases/compiler/implementGenericWithMismatchedTypes.ts(17,5): error TS2416: Property 'foo' in type 'C2' is not assignable to the same property in base type 'IFoo2'. Type '(x: Tstring) => number' is not assignable to type '(x: T) => T'. Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/implementGenericWithMismatchedTypes.ts (2 errors) ==== @@ -35,7 +35,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(17,5): error TS2416: !!! error TS2416: Property 'foo' in type 'C2' is not assignable to the same property in base type 'IFoo2'. !!! error TS2416: Type '(x: Tstring) => number' is not assignable to type '(x: T) => T'. !!! error TS2416: Type 'number' is not assignable to type 'T'. -!!! error TS2416: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. return null; } } \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt b/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt index 2a7a2f9638101..590731e4a2965 100644 --- a/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt +++ b/tests/baselines/reference/incompatibleAssignmentOfIdenticallyNamedTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/incompatibleAssignmentOfIdenticallyNamedTypes.ts(6,9): error TS2719: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/compiler/incompatibleAssignmentOfIdenticallyNamedTypes.ts (1 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/incompatibleAssignmentOfIdenticallyNamedTypes.ts(6,9): erro this.x = a; ~~~~~~ !!! error TS2719: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2719: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2719: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureAndMappedType.errors.txt b/tests/baselines/reference/indexSignatureAndMappedType.errors.txt index c40293f428074..7e94dbed718c4 100644 --- a/tests/baselines/reference/indexSignatureAndMappedType.errors.txt +++ b/tests/baselines/reference/indexSignatureAndMappedType.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/indexSignatureAndMappedType.ts(6,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. tests/cases/compiler/indexSignatureAndMappedType.ts(15,5): error TS2322: Type 'Record' is not assignable to type '{ [key: string]: T; }'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/indexSignatureAndMappedType.ts(16,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. @@ -26,7 +26,7 @@ tests/cases/compiler/indexSignatureAndMappedType.ts(16,5): error TS2322: Type '{ ~ !!! error TS2322: Type 'Record' is not assignable to type '{ [key: string]: T; }'. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; // Error ~ !!! error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. diff --git a/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt b/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt index a714814fa9ca7..2df05fd6a04e0 100644 --- a/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt +++ b/tests/baselines/reference/infiniteExpansionThroughInstantiation.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansion tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts(21,5): error TS2322: Type 'OwnerList' is not assignable to type 'List'. Types of property 'data' are incompatible. Type 'List' is not assignable to type 'T'. - 'List' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'List' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansionThroughInstantiation.ts (2 errors) ==== @@ -37,7 +37,7 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/infiniteExpansion !!! error TS2322: Type 'OwnerList' is not assignable to type 'List'. !!! error TS2322: Types of property 'data' are incompatible. !!! error TS2322: Type 'List' is not assignable to type 'T'. -!!! error TS2322: 'List' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'List' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/intersectionTypeInference.errors.txt b/tests/baselines/reference/intersectionTypeInference.errors.txt index cdfa299042895..b6c8ef8aa4e73 100644 --- a/tests/baselines/reference/intersectionTypeInference.errors.txt +++ b/tests/baselines/reference/intersectionTypeInference.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/types/intersection/intersectionTypeInference.ts(5,5): error TS2322: Type 'T' is not assignable to type 'T & U'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/intersection/intersectionTypeInference.ts(6,5): error TS2322: Type 'U' is not assignable to type 'T & U'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/intersection/intersectionTypeInference.ts (2 errors) ==== @@ -15,12 +15,12 @@ tests/cases/conformance/types/intersection/intersectionTypeInference.ts(6,5): er ~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'T & U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. result = obj2; // Error ~~~~~~ !!! error TS2322: Type 'U' is not assignable to type 'T & U'. !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. return result; } diff --git a/tests/baselines/reference/invalidBooleanAssignments.errors.txt b/tests/baselines/reference/invalidBooleanAssignments.errors.txt index 6265f2b70a9e2..bfa14d090a6f6 100644 --- a/tests/baselines/reference/invalidBooleanAssignments.errors.txt +++ b/tests/baselines/reference/invalidBooleanAssignments.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(15 tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(17,5): error TS2322: Type 'true' is not assignable to type '() => string'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(21,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(24,5): error TS2322: Type 'boolean' is not assignable to type 'T'. - 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'boolean' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26,1): error TS2539: Cannot assign to 'i' because it is not a variable. @@ -54,7 +54,7 @@ tests/cases/conformance/types/primitives/boolean/invalidBooleanAssignments.ts(26 a = x; ~ !!! error TS2322: Type 'boolean' is not assignable to type 'T'. -!!! error TS2322: 'boolean' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'boolean' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } i = x; ~ diff --git a/tests/baselines/reference/invalidNumberAssignments.errors.txt b/tests/baselines/reference/invalidNumberAssignments.errors.txt index 03e27b5c480ad..6ddda47eefab9 100644 --- a/tests/baselines/reference/invalidNumberAssignments.errors.txt +++ b/tests/baselines/reference/invalidNumberAssignments.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(14,5 tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(15,5): error TS2322: Type '1' is not assignable to type '{ 0: number; }'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(18,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(21,5): error TS2322: Type 'number' is not assignable to type 'T'. - 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1): error TS2539: Cannot assign to 'i' because it is not a variable. @@ -51,7 +51,7 @@ tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1 a = x; ~ !!! error TS2322: Type 'number' is not assignable to type 'T'. -!!! error TS2322: 'number' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } i = x; ~ diff --git a/tests/baselines/reference/invalidStringAssignments.errors.txt b/tests/baselines/reference/invalidStringAssignments.errors.txt index 8502ab913205b..5ef87e2b94dd5 100644 --- a/tests/baselines/reference/invalidStringAssignments.errors.txt +++ b/tests/baselines/reference/invalidStringAssignments.errors.txt @@ -7,7 +7,7 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(14,5 tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(15,5): error TS2322: Type '1' is not assignable to type '{ 0: number; }'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(18,1): error TS2539: Cannot assign to 'M' because it is not a variable. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(23,1): error TS2539: Cannot assign to 'i' because it is not a variable. tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(26,5): error TS2322: Type 'string' is not assignable to type 'E'. @@ -52,7 +52,7 @@ tests/cases/conformance/types/primitives/string/invalidStringAssignments.ts(26,5 a = x; ~ !!! error TS2322: Type 'string' is not assignable to type 'T'. -!!! error TS2322: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } i = x; ~ diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 0c0e1d199cac8..68e56efb38ab9 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -44,36 +44,36 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(87,5): error Type 'keyof T' is not assignable to type 'keyof T & keyof U'. Type 'keyof T' is not assignable to type 'keyof U'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(103,9): error TS2322: Type 'Extract' is not assignable to type 'K'. - 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. Type 'string & keyof T' is not assignable to type 'K'. - 'string & keyof T' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + 'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. Type 'string' is not assignable to type 'K'. - 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. Type 'string' is not assignable to type 'K'. - 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(105,9): error TS2322: Type 'T[Extract]' is not assignable to type 'T[K]'. Type 'Extract' is not assignable to type 'K'. - 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. + 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(108,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(111,5): error TS2322: Type 'T[J]' is not assignable to type 'U[J]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. 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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. + 'K' is assignable to the constraint of type 'J', but 'J' could be instantiated with a different subtype of constraint 'string'. Type 'Extract' is not assignable to type 'J'. - 'Extract' is assignable to the constraint of type 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. + 'Extract' 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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. + '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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. + 'string' 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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. + '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'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type '42' is not assignable to type 'keyof T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type '"hello"' is not assignable to type 'keyof T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'. @@ -262,55 +262,55 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error k = key // error, keyof T =/=> K ~ !!! error TS2322: Type 'Extract' is not assignable to type 'K'. -!!! error TS2322: 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. !!! error TS2322: Type 'string & keyof T' is not assignable to type 'K'. -!!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'string & keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. !!! error TS2322: Type 'string' is not assignable to type 'K'. -!!! error TS2322: 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. !!! error TS2322: Type 'string' is not assignable to type 'K'. -!!! error TS2322: 'string' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. t[key] = tk; // ok, T[K] ==> T[keyof T] tk = t[key]; // error, T[keyof T] =/=> T[K] ~~ !!! error TS2322: Type 'T[Extract]' is not assignable to type 'T[K]'. !!! error TS2322: Type 'Extract' is not assignable to type 'K'. -!!! error TS2322: 'Extract' is assignable to the constraint of type 'string', but 'K' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'Extract' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string'. } tk = uk; uk = tk; // error ~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tj = uj; uj = tj; // error ~~ !!! error TS2322: Type 'T[J]' is not assignable to type 'U[J]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tk = tj; tj = tk; // 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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. +!!! 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' is not assignable to type 'J'. -!!! error TS2322: 'Extract' is assignable to the constraint of type 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: 'Extract' 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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. +!!! 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 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. +!!! error TS2322: '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' is not assignable to type 'J'. -!!! error TS2322: 'string' is assignable to the constraint of type 'string', but 'J' could be instantiated with a different subtype of constraint 'string'. +!!! 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 ~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[J]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } // The constraint of 'keyof T' is 'keyof T' diff --git a/tests/baselines/reference/mappedTypeRelationships.errors.txt b/tests/baselines/reference/mappedTypeRelationships.errors.txt index 4f4c5050095d6..4b13079918197 100644 --- a/tests/baselines/reference/mappedTypeRelationships.errors.txt +++ b/tests/baselines/reference/mappedTypeRelationships.errors.txt @@ -1,18 +1,18 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(11,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(16,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(20,5): error TS2536: Type 'keyof U' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,5): error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,12): error TS2536: Type 'keyof U' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(25,5): error TS2536: Type 'K' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,12): error TS2536: Type 'K' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(30,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'T[keyof T]'. Type 'undefined' is not assignable to type 'T[keyof T]'. @@ -23,61 +23,61 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(40,5): error TS2 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(41,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'. Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(45,5): error TS2322: Type 'U[K] | undefined' is not assignable to type 'T[K]'. Type 'undefined' is not assignable to type 'T[K]'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(46,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'. Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(51,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(56,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(66,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(72,5): error TS2322: Type 'Partial' is not assignable to type 'T'. - 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(78,5): error TS2322: Type 'Partial' is not assignable to type 'Partial'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(88,5): error TS2322: Type 'Readonly' is not assignable to type 'Readonly'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(127,5): error TS2322: Type 'Partial' is not assignable to type 'Identity'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(143,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. Type 'T[P]' is not assignable to type 'U[P]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(148,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. Type 'keyof U' is not assignable to type 'keyof T'. Type 'string | number | symbol' is not assignable to type 'keyof T'. Type 'string' is not assignable to type 'keyof T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(153,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'. Type 'keyof T' is not assignable to type 'K'. - 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. Type 'string | number | symbol' is not assignable to type 'K'. - 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. Type 'string' is not assignable to type 'K'. - 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(158,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. Type 'keyof U' is not assignable to type 'K'. - 'keyof U' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'keyof U' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. Type 'string | number | symbol' is not assignable to type 'K'. - 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. Type 'string' is not assignable to type 'K'. - 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(163,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. Type 'keyof T' is not assignable to type 'K'. - 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. Type 'string | number | symbol' is not assignable to type 'K'. - 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. Type 'string' is not assignable to type 'K'. - 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. + 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'. Type 'T[P]' is not assignable to type 'U[P]'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (30 errors) ==== @@ -95,7 +95,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f4(x: T, y: U, k: K) { @@ -104,7 +104,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f5(x: T, y: U, k: keyof U) { @@ -115,7 +115,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2536: Type 'keyof U' cannot be used to index type 'T'. } @@ -128,7 +128,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2536: Type 'K' cannot be used to index type 'T'. } @@ -159,7 +159,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'. !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f13(x: T, y: Partial, k: K) { @@ -172,7 +172,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'. !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f20(x: T, y: Readonly, k: keyof T) { @@ -195,7 +195,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2542: Index signature in type 'Readonly' only permits reading. } @@ -206,7 +206,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~~~~ !!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ~~~~ !!! error TS2542: Index signature in type 'Readonly' only permits reading. } @@ -217,7 +217,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS x = y; // Error ~ !!! error TS2322: Type 'Partial' is not assignable to type 'T'. -!!! error TS2322: 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. y = x; } @@ -299,7 +299,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. !!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f72(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) { @@ -318,11 +318,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~ !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'. !!! error TS2322: Type 'keyof T' is not assignable to type 'K'. -!!! error TS2322: 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. !!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. -!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. !!! error TS2322: Type 'string' is not assignable to type 'K'. -!!! error TS2322: 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. } function f74(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) { @@ -331,11 +331,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~ !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. !!! error TS2322: Type 'keyof U' is not assignable to type 'K'. -!!! error TS2322: 'keyof U' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'keyof U' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. !!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. -!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. !!! error TS2322: Type 'string' is not assignable to type 'K'. -!!! error TS2322: 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. } function f75(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) { @@ -344,11 +344,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS ~ !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. !!! error TS2322: Type 'keyof T' is not assignable to type 'K'. -!!! error TS2322: 'keyof T' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'keyof T' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. !!! error TS2322: Type 'string | number | symbol' is not assignable to type 'K'. -!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'string | number | symbol' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. !!! error TS2322: Type 'string' is not assignable to type 'K'. -!!! error TS2322: 'string' is assignable to the constraint of type 'string | number | symbol', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. +!!! error TS2322: 'string' is assignable to the constraint of type 'K', but 'K' could be instantiated with a different subtype of constraint 'string | number | symbol'. } function f76(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) { @@ -358,7 +358,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS !!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'. !!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } function f80(t: T): Partial { diff --git a/tests/baselines/reference/mappedTypes5.errors.txt b/tests/baselines/reference/mappedTypes5.errors.txt index 21d6f98964ae5..3b9f3423941ca 100644 --- a/tests/baselines/reference/mappedTypes5.errors.txt +++ b/tests/baselines/reference/mappedTypes5.errors.txt @@ -2,6 +2,7 @@ tests/cases/conformance/types/mapped/mappedTypes5.ts(6,9): error TS2322: Type 'P tests/cases/conformance/types/mapped/mappedTypes5.ts(8,9): error TS2322: Type 'Partial>' is not assignable to type 'Readonly'. tests/cases/conformance/types/mapped/mappedTypes5.ts(9,9): error TS2322: Type 'Readonly>' is not assignable to type 'Readonly'. Type 'Partial' is not assignable to type 'T'. + 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/mapped/mappedTypes5.ts (3 errors) ==== @@ -21,6 +22,7 @@ tests/cases/conformance/types/mapped/mappedTypes5.ts(9,9): error TS2322: Type 'R ~~ !!! error TS2322: Type 'Readonly>' is not assignable to type 'Readonly'. !!! error TS2322: Type 'Partial' is not assignable to type 'T'. +!!! error TS2322: 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. let c1: Partial> = p; let c2: Partial> = r; let c3: Partial> = pr; diff --git a/tests/baselines/reference/mappedTypes6.errors.txt b/tests/baselines/reference/mappedTypes6.errors.txt index 834f0826c7fb3..7b2cdd10b8522 100644 --- a/tests/baselines/reference/mappedTypes6.errors.txt +++ b/tests/baselines/reference/mappedTypes6.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(23,5): error TS2322: Type 'T' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(24,5): error TS2322: Type 'Partial' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(27,5): error TS2322: Type 'Partial' is not assignable to type 'T'. - 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypes6.ts(37,5): error TS2322: Type 'Required' is not assignable to type 'Denullified'. Type 'T[P]' is not assignable to type 'NonNullable'. tests/cases/conformance/types/mapped/mappedTypes6.ts(38,5): error TS2322: Type 'T' is not assignable to type 'Denullified'. @@ -9,11 +9,11 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(39,5): error TS2322: Type ' tests/cases/conformance/types/mapped/mappedTypes6.ts(42,5): error TS2322: Type 'T' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(43,5): error TS2322: Type 'Partial' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(47,5): error TS2322: Type 'Partial' is not assignable to type 'T'. - 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypes6.ts(56,5): error TS2322: Type '{}' is not assignable to type 'Denullified'. tests/cases/conformance/types/mapped/mappedTypes6.ts(57,5): error TS2322: Type '{}' is not assignable to type 'Required'. tests/cases/conformance/types/mapped/mappedTypes6.ts(58,5): error TS2322: Type '{}' is not assignable to type 'T'. - '{}' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + '{}' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/mapped/mappedTypes6.ts(92,1): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type 'Foo'. tests/cases/conformance/types/mapped/mappedTypes6.ts(104,1): error TS2739: Type '{ a: number; }' is missing the following properties from type 'Required': b, c, d tests/cases/conformance/types/mapped/mappedTypes6.ts(105,1): error TS2739: Type '{ a: number; b: number; }' is missing the following properties from type 'Required': c, d @@ -57,7 +57,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno y = z; // Error ~ !!! error TS2322: Type 'Partial' is not assignable to type 'T'. -!!! error TS2322: 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. z = x; z = y; z = z; @@ -91,7 +91,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno y = z; // Error ~ !!! error TS2322: Type 'Partial' is not assignable to type 'T'. -!!! error TS2322: 'Partial' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'Partial' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. z = w; z = x; z = y; @@ -109,7 +109,7 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno y = {}; // Error ~ !!! error TS2322: Type '{}' is not assignable to type 'T'. -!!! error TS2322: '{}' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: '{}' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. z = {}; } diff --git a/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt b/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt index f84ef93e314ed..7e69f57747635 100644 --- a/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt +++ b/tests/baselines/reference/nonPrimitiveAndTypeVariables.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(10,9): error TS2322: Type 'T' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(11,9): error TS2322: Type 'T' is not assignable to type 'object | U'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts (2 errors) ==== @@ -21,6 +21,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(11,9) ~ !!! error TS2322: Type 'T' is not assignable to type 'object | U'. !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt index 488d9a90d9cf9..4721cc7288227 100644 --- a/tests/baselines/reference/objectLiteralExcessProperties.errors.txt +++ b/tests/baselines/reference/objectLiteralExcessProperties.errors.txt @@ -23,10 +23,10 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(33,27): error TS2322: Type Object literal may only specify known properties, but 'colour' does not exist in type 'Cover'. Did you mean to write 'color'? tests/cases/compiler/objectLiteralExcessProperties.ts(37,25): error TS2304: Cannot find name 'IFoo'. tests/cases/compiler/objectLiteralExcessProperties.ts(39,11): error TS2322: Type '{ name: string; }' is not assignable to type 'T'. - '{ name: string; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. + '{ name: string; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'any'. tests/cases/compiler/objectLiteralExcessProperties.ts(41,11): error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type 'T & { prop: boolean; }'. Type '{ name: string; prop: boolean; }' is not assignable to type 'T'. - '{ name: string; prop: boolean; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. + '{ name: string; prop: boolean; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'any'. tests/cases/compiler/objectLiteralExcessProperties.ts(43,43): error TS2322: Type '{ name: string; prop: true; }' is not assignable to type 'T | { prop: boolean; }'. Object literal may only specify known properties, and 'name' does not exist in type '{ prop: boolean; }'. tests/cases/compiler/objectLiteralExcessProperties.ts(45,76): error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type '{ name: string; } | (T & { prop: boolean; })'. @@ -113,13 +113,13 @@ tests/cases/compiler/objectLiteralExcessProperties.ts(49,44): error TS2322: Type const obj1: T = { name: "test" }; ~~~~ !!! error TS2322: Type '{ name: string; }' is not assignable to type 'T'. -!!! error TS2322: '{ name: string; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. +!!! error TS2322: '{ name: string; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'any'. // No excess property checks on intersections involving generics const obj2: T & { prop: boolean } = { name: "test", prop: true }; ~~~~ !!! error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type 'T & { prop: boolean; }'. !!! error TS2322: Type '{ name: string; prop: boolean; }' is not assignable to type 'T'. -!!! error TS2322: '{ name: string; prop: boolean; }' is assignable to the constraint of type 'any', but 'T' could be instantiated with a different subtype of constraint 'any'. +!!! error TS2322: '{ name: string; prop: boolean; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'any'. // Excess property checks only on non-generic parts of unions const obj3: T | { prop: boolean } = { name: "test", prop: true }; ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt index 99dc4006ad951..72093dab99e9a 100644 --- a/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt +++ b/tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt @@ -5,17 +5,17 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec Types of property 'data' are incompatible. 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 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List'. Type 'MyList' is not assignable to type 'T'. - 'MyList' is assignable to the constraint of type 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. + 'MyList' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List'. 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 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. + 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList'. Type 'List' is not assignable to type 'U'. - 'List' is assignable to the constraint of type 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. + 'List' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList'. 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 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. Type 'MyList' is not assignable to type 'T'. - 'MyList' is assignable to the constraint of type 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. + 'MyList' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. ==== tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRecursiveWrappedPropertyCheckedNominally.ts (5 errors) ==== @@ -59,15 +59,15 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List'. !!! error TS2322: Type 'MyList' is not assignable to type 'T'. -!!! error TS2322: 'MyList' is assignable to the constraint of type 'List', but 'T' could be instantiated with a different subtype of constraint 'List'. +!!! error TS2322: 'MyList' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'List'. u = t; // error ~ !!! error TS2322: Type 'T' is not assignable to type 'U'. -!!! error TS2322: 'T' is assignable to the constraint of type 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. +!!! error TS2322: 'T' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList'. !!! error TS2322: Type 'List' is not assignable to type 'U'. -!!! error TS2322: 'List' is assignable to the constraint of type 'MyList', but 'U' could be instantiated with a different subtype of constraint 'MyList'. +!!! error TS2322: 'List' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'MyList'. var a: List; var b: MyList; @@ -81,9 +81,9 @@ tests/cases/conformance/types/typeRelationships/recursiveTypes/objectTypeWithRec t = u; // error ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. -!!! error TS2322: 'U' is assignable to the constraint of type 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. +!!! error TS2322: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. !!! error TS2322: Type 'MyList' is not assignable to type 'T'. -!!! error TS2322: 'MyList' is assignable to the constraint of type 'MyList', but 'T' could be instantiated with a different subtype of constraint 'MyList'. +!!! error TS2322: 'MyList' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'MyList'. u = t; // was error, ok after constraint made illegal, doesn't matter var a: List; diff --git a/tests/baselines/reference/subtypesOfTypeParameter.errors.txt b/tests/baselines/reference/subtypesOfTypeParameter.errors.txt index fb80fd1ead1e7..0ec8951fe9391 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameter.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts(8,5): error TS2416: Property 'foo' in type 'D1' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameter.ts (1 errors) ==== @@ -15,7 +15,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D1' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } function f1(x: T, y: U) { diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt index 7b62e9d54f058..5fe0186e04a1b 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.errors.txt @@ -1,53 +1,53 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. Type 'V' is not assignable to type 'T'. - 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2416: Property 'foo' in type 'D11' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'T'. - 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2416: Property 'foo' in type 'D12' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'U'. - 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. + 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2416: Property 'foo' in type 'D19' is not assignable to the same property in base type 'C3'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'T'. - 'V' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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' is not assignable to the same property in base type 'C3'. Type 'V' is not assignable to type 'U'. - 'V' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'T'. - 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. + '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(161,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(161,5): error TS2416: Property 'foo' in type 'D28' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'U'. - 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. + '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(166,5): error TS2411: Property 'foo' of type 'Date' is not assignable to string index type 'V'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(166,5): error TS2416: Property 'foo' in type 'D29' is not assignable to the same property in base type 'C3'. Type 'Date' is not assignable to type 'V'. - 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. + '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/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts (20 errors) ==== @@ -75,7 +75,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D3' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } class D4 extends C3 { @@ -112,9 +112,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D8' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: 'U' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: 'U' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! error TS2416: Type 'V' is not assignable to type 'T'. -!!! error TS2416: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } class D9 extends C3 { @@ -137,7 +137,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D11' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'T'. -!!! error TS2416: 'V' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: 'V' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. } class D12 extends C3 { @@ -148,7 +148,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D12' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'U'. -!!! error TS2416: 'V' is assignable to the constraint of type '{}', but 'U' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2416: 'V' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '{}'. } class D13 extends C3 { @@ -194,11 +194,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D19' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: 'U' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 extends C3 { @@ -226,9 +226,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D23' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'T'. -!!! error TS2416: 'V' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 extends C3 { @@ -239,9 +239,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D24' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'V' is not assignable to type 'U'. -!!! error TS2416: 'V' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! 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 extends C3 { @@ -264,7 +264,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D27' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'T'. -!!! error TS2416: 'Date' is assignable to the constraint of type 'Date', but 'T' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2416: 'Date' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Date'. } class D28 extends C3 { @@ -275,7 +275,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D28' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'U'. -!!! error TS2416: 'Date' is assignable to the constraint of type 'Date', but 'U' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2416: 'Date' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Date'. } class D29 extends C3 { @@ -286,5 +286,5 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D29' is not assignable to the same property in base type 'C3'. !!! error TS2416: Type 'Date' is not assignable to type 'V'. -!!! error TS2416: 'Date' is assignable to the constraint of type 'Date', but 'V' could be instantiated with a different subtype of constraint 'Date'. +!!! error TS2416: 'Date' is assignable to the constraint of type 'V', but 'V' could be instantiated with a different subtype of constraint 'Date'. } \ No newline at end of file diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt index b8217ce3ef426..03656c08c4ef2 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.errors.txt @@ -4,18 +4,18 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(57,5): error TS2416: Property 'foo' in type 'D5' is not assignable to the same property in base type 'B1'. Type 'U' is not assignable to type 'T'. - 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + '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'. - 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. + 'Foo' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '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' is not assignable to the same property in base type 'B1'. Type 'V' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints4.ts(67,5): error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'B1'. Type 'T' is not assignable to type 'U'. - 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + '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'. - 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. + 'Foo' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint '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' is not assignable to the same property in base type 'B1'. Type 'V' is not assignable to type 'U'. @@ -89,9 +89,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D5' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'U' is not assignable to type 'T'. -!!! error TS2416: 'U' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! 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: 'Foo' is assignable to the constraint of type 'Foo', but 'T' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2416: 'Foo' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Foo'. } class D6 extends B1 { @@ -112,9 +112,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf ~~~ !!! error TS2416: Property 'foo' in type 'D7' is not assignable to the same property in base type 'B1'. !!! error TS2416: Type 'T' is not assignable to type 'U'. -!!! error TS2416: 'T' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! 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: 'Foo' is assignable to the constraint of type 'Foo', but 'U' could be instantiated with a different subtype of constraint 'Foo'. +!!! error TS2416: 'Foo' is assignable to the constraint of type 'U', but 'U' could be instantiated with a different subtype of constraint 'Foo'. } class D8 extends B1 { diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt index 9156a7769e59f..7dfb078170a6d 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithSpecializedSignatures.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type '(x: T) => string' is not assignable to type '(x: T) => T'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithSpecializedSignatures.ts (2 errors) ==== @@ -96,7 +96,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: T) => string' is not assignable to type '(x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt b/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt index 843ca8085ea98..2f314864f9886 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.errors.txt @@ -3,32 +3,32 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(28,11): error TS2430: Interface 'I2' incorrectly extends interface 'A'. Types of property 'a2' are incompatible. Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(32,11): error TS2430: Interface 'I3' incorrectly extends interface 'A'. Types of property 'a3' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(36,11): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a4' are incompatible. Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(40,11): error TS2430: Interface 'I5' incorrectly extends interface 'A'. Types of property 'a5' are incompatible. Type 'new (x: (arg: T) => U) => T' is not assignable to type 'new (x: (arg: T) => U) => T'. Types of parameters 'x' and 'x' are incompatible. Types of parameters 'arg' and 'arg' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(44,11): error TS2430: Interface 'I7' incorrectly extends interface 'A'. Types of property 'a11' are incompatible. Type 'new (x: { foo: T; }, y: { foo: U; bar: U; }) => Base' is not assignable to type 'new (x: { foo: T; }, y: { foo: T; bar: T; }) => Base'. @@ -36,7 +36,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'foo' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts(48,11): error TS2430: Interface 'I9' incorrectly extends interface 'A'. Types of property 'a16' are incompatible. Type 'new (x: { a: T; b: T; }) => T[]' is not assignable to type 'new (x: { a: T; b: T; }) => T[]'. @@ -44,9 +44,9 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. Types of property 'a' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. Type 'Base' is not assignable to type 'T'. - 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts (7 errors) ==== @@ -80,7 +80,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T[]' is not assignable to type 'new (x: T) => T[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new (x: T) => T[]; } @@ -91,7 +91,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => string[]' is not assignable to type 'new (x: T) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => string[]; } @@ -102,7 +102,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T) => void'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x: T) => T; } @@ -113,7 +113,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T, y: U) => string' is not assignable to type 'new (x: T, y: U) => string'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T, y: U) => string; } @@ -125,7 +125,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Types of parameters 'arg' and 'arg' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: (arg: T) => U) => T; } @@ -138,7 +138,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '{ foo: T; }' is not assignable to type '{ foo: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'foo' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a11: new (x: { foo: T }, y: { foo: U; bar: U }) => Base; } @@ -151,8 +151,8 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '{ a: T; b: T; }' is not assignable to type '{ a: T; b: T; }'. Two different types with this name exist, but they are unrelated. !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. !!! error TS2430: Type 'Base' is not assignable to type 'T'. -!!! error TS2430: 'Base' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'Base' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a16: new (x: { a: T; b: T }) => T[]; } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt index 8247c87a55e6a..8f4a219407ab3 100644 --- a/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt +++ b/tests/baselines/reference/subtypingWithConstructSignaturesWithSpecializedSignatures.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. Type 'string' is not assignable to type 'T'. - 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignaturesWithSpecializedSignatures.ts (2 errors) ==== @@ -96,7 +96,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new (x: T) => string' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Type 'string' is not assignable to type 'T'. -!!! error TS2430: 'string' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'string' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. // N's a2: new (x: T) => string; // error because base returns non-void; } diff --git a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt index ecd7ddb36ee72..36380fc97f4f0 100644 --- a/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericCallSignaturesWithOptionalParameters.errors.txt @@ -8,12 +8,12 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a' are incompatible. Type '() => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x?: T) => T' is not assignable to type '() => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. @@ -21,36 +21,36 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type '() => T' is not assignable to type '(x?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(121,15): error TS2430: Interface 'I6' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type '(x: T) => T' is not assignable to type '(x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '() => T' is not assignable to type '(x: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x?: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(134,15): error TS2430: Interface 'I9' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x: T) => T' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(138,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T) => T'. @@ -58,48 +58,48 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a4' are incompatible. Type '() => T' is not assignable to type '(x: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(151,15): error TS2430: Interface 'I13' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(155,15): error TS2430: Interface 'I14' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(168,15): error TS2430: Interface 'I17' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(172,15): error TS2430: Interface 'I18' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type '(x: T, y: T) => T' is not assignable to type '(x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericCallSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type '(x: T) => T' is not assignable to type '() => T'. @@ -222,7 +222,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '() => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: () => T; } @@ -232,7 +232,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x?: T) => T' is not assignable to type '() => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: (x?: T) => T; } @@ -251,7 +251,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: () => T; } @@ -262,7 +262,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x?: T) => T } @@ -273,7 +273,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: (x: T) => T; } @@ -284,7 +284,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: () => T; } @@ -295,7 +295,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: (x?: T) => T; } @@ -306,7 +306,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: (x: T) => T; } @@ -325,7 +325,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: () => T; } @@ -336,7 +336,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T, y?: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x?: T, y?: T) => T; } @@ -347,7 +347,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x: T) => T; } @@ -358,7 +358,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T, y: T) => T' is not assignable to type '(x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: (x: T, y: T) => T; } @@ -369,7 +369,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a5' are incompatible. !!! error TS2430: Type '() => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: () => T; } @@ -380,7 +380,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x?: T, y?: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x?: T, y?: T) => T; } @@ -391,7 +391,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x: T) => T; } @@ -402,7 +402,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type '(x: T, y: T) => T' is not assignable to type '(x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: (x: T, y: T) => T; } } diff --git a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt index 0d8f51c2688e7..427c7c1f19e8f 100644 --- a/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithGenericConstructSignaturesWithOptionalParameters.errors.txt @@ -8,12 +8,12 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a' are incompatible. Type 'new () => T' is not assignable to type 'new () => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(104,15): error TS2430: Interface 'I2' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new () => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(108,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. @@ -21,36 +21,36 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a2' are incompatible. Type 'new () => T' is not assignable to type 'new (x?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(117,15): error TS2430: Interface 'I5' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new (x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(121,15): error TS2430: Interface 'I6' incorrectly extends interface 'Base2'. Types of property 'a2' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(126,15): error TS2430: Interface 'I7' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new () => T' is not assignable to type 'new (x: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(130,15): error TS2430: Interface 'I8' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x?: T) => T' is not assignable to type 'new (x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(134,15): error TS2430: Interface 'I9' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(138,15): error TS2430: Interface 'I10' incorrectly extends interface 'Base2'. Types of property 'a3' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T) => T'. @@ -58,48 +58,48 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a4' are incompatible. Type 'new () => T' is not assignable to type 'new (x: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(147,15): error TS2430: Interface 'I12' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(151,15): error TS2430: Interface 'I13' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(155,15): error TS2430: Interface 'I14' incorrectly extends interface 'Base2'. Types of property 'a4' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(160,15): error TS2430: Interface 'I15' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new () => T' is not assignable to type 'new (x?: T, y?: T) => T'. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(164,15): error TS2430: Interface 'I16' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(168,15): error TS2430: Interface 'I17' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(172,15): error TS2430: Interface 'I18' incorrectly extends interface 'Base2'. Types of property 'a5' are incompatible. Type 'new (x: T, y: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. Types of parameters 'x' and 'x' are incompatible. Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. - 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. + 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithGenericConstructSignaturesWithOptionalParameters.ts(196,15): error TS2430: Interface 'I3' incorrectly extends interface 'Base2'. Types of property 'a' are incompatible. Type 'new (x: T) => T' is not assignable to type 'new () => T'. @@ -222,7 +222,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new () => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new () => T; } @@ -232,7 +232,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new () => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a: new (x?: T) => T; } @@ -251,7 +251,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new () => T; } @@ -262,7 +262,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new (x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x?: T) => T } @@ -273,7 +273,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a2: new (x: T) => T; } @@ -284,7 +284,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new () => T; } @@ -295,7 +295,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T) => T' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x?: T) => T; } @@ -306,7 +306,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a3: new (x: T) => T; } @@ -325,7 +325,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new () => T; } @@ -336,7 +336,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x?: T, y?: T) => T; } @@ -347,7 +347,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T) => T; } @@ -358,7 +358,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T, y: T) => T' is not assignable to type 'new (x: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a4: new (x: T, y: T) => T; } @@ -369,7 +369,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a5' are incompatible. !!! error TS2430: Type 'new () => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new () => T; } @@ -380,7 +380,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x?: T, y?: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x?: T, y?: T) => T; } @@ -391,7 +391,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: T) => T; } @@ -402,7 +402,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Type 'new (x: T, y: T) => T' is not assignable to type 'new (x?: T, y?: T) => T'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. !!! error TS2430: Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated. -!!! error TS2430: 'T' is assignable to the constraint of type '{}', but 'T' could be instantiated with a different subtype of constraint '{}'. +!!! error TS2430: 'T' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. a5: new (x: T, y: T) => T; } } diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt index a7f53b4411e44..0c79c352a4c85 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer.ts (2 errors) ==== @@ -45,7 +45,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B3' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. -!!! error TS2415: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: number]: Derived; // error, BUG? } @@ -54,7 +54,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: number]: Derived2; // error, BUG? } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt index fc5477612e893..4915510dec768 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer2.errors.txt @@ -8,11 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer2.ts(36,15): error TS2430: Interface 'B4' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer2.ts (5 errors) ==== @@ -67,7 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B4' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived' is not assignable to type 'T'. -!!! error TS2430: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2430: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: number]: Derived; // error } @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B5' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2430: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. +!!! error TS2430: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: number]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt index 48f6676b91bf1..ee132ac7483bb 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.errors.txt @@ -8,11 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer3.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer3.ts (5 errors) ==== @@ -67,7 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. -!!! error TS2415: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: number]: Derived; // error } @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B5' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: number]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt b/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt index 51a5f1c5f1320..fb4d430a09a00 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt +++ b/tests/baselines/reference/subtypingWithNumericIndexer5.errors.txt @@ -8,11 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts(36,11): error TS2420: Class 'B4' incorrectly implements interface 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts(40,11): error TS2420: Class 'B5' incorrectly implements interface 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer5.ts (4 errors) ==== @@ -66,7 +66,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2420: Class 'B4' incorrectly implements interface 'A'. !!! error TS2420: Index signatures are incompatible. !!! error TS2420: Type 'Derived' is not assignable to type 'T'. -!!! error TS2420: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2420: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: string]: Derived; // error } @@ -75,7 +75,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2420: Class 'B5' incorrectly implements interface 'A'. !!! error TS2420: Index signatures are incompatible. !!! error TS2420: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2420: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. +!!! error TS2420: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: string]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithStringIndexer.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer.errors.txt index a5156f0befe7c..80a1a6acfc043 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer.ts(32,11): error TS2415: Class 'B3' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer.ts (2 errors) ==== @@ -45,7 +45,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B3' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. -!!! error TS2415: 'Derived' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: string]: Derived; // error } @@ -54,7 +54,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Base', but 'T' could be instantiated with a different subtype of constraint 'Base'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Base'. [x: string]: Derived2; // error } } diff --git a/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt index a2619411a20df..214a17258c9dd 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer2.errors.txt @@ -8,11 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer2.ts(36,15): error TS2430: Interface 'B4' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer2.ts(40,15): error TS2430: Interface 'B5' incorrectly extends interface 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer2.ts (5 errors) ==== @@ -67,7 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B4' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived' is not assignable to type 'T'. -!!! error TS2430: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2430: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: string]: Derived; // error } @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Interface 'B5' incorrectly extends interface 'A'. !!! error TS2430: Index signatures are incompatible. !!! error TS2430: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2430: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. +!!! error TS2430: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: string]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt index 64736f5278c3d..8016421c07f29 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt +++ b/tests/baselines/reference/subtypingWithStringIndexer3.errors.txt @@ -8,11 +8,11 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer3.ts(36,11): error TS2415: Class 'B4' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. - 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. + 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer3.ts(40,11): error TS2415: Class 'B5' incorrectly extends base class 'A'. Index signatures are incompatible. Type 'Derived2' is not assignable to type 'T'. - 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. + 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithStringIndexer3.ts (5 errors) ==== @@ -67,7 +67,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B4' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived' is not assignable to type 'T'. -!!! error TS2415: 'Derived' is assignable to the constraint of type 'Derived', but 'T' could be instantiated with a different subtype of constraint 'Derived'. +!!! error TS2415: 'Derived' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived'. [x: string]: Derived; // error } @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2415: Class 'B5' incorrectly extends base class 'A'. !!! error TS2415: Index signatures are incompatible. !!! error TS2415: Type 'Derived2' is not assignable to type 'T'. -!!! error TS2415: 'Derived2' is assignable to the constraint of type 'Derived2', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. +!!! error TS2415: 'Derived2' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived2'. [x: string]: Derived2; // error } } \ No newline at end of file diff --git a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt index a2f7a268032bb..7fe6609cc9615 100644 --- a/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt +++ b/tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(14,14): error TS2322: Type '{}' is not assignable to type 'P'. - '{}' is assignable to the constraint of type '{}', but 'P' could be instantiated with a different subtype of constraint '{}'. + '{}' is assignable to the constraint of type 'P', but 'P' could be instantiated with a different subtype of constraint '{}'. tests/cases/compiler/tsxNotUsingApparentTypeOfSFC.tsx(15,14): error TS2322: Type '{}' is not assignable to type 'Readonly