Unnecessary elaboration about not being assignable to type parameters (#42952)

This commit is contained in:
Jonas Hübotter 2021-03-05 20:15:05 +01:00 committed by GitHub
parent 408c804103
commit 25375a2213
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 162 additions and 186 deletions

View File

@ -17229,6 +17229,7 @@ namespace ts {
);
}
else {
errorInfo = undefined;
reportError(
Diagnostics._0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1,
targetType,

View File

@ -45,8 +45,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign
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' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Base' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Base'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance6.ts (7 errors) ====
@ -152,7 +150,5 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign
!!! 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' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2430: Type 'Base' is not assignable to type 'T'.
!!! error TS2430: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Base'.
a16: (x: { a: T; b: T }) => T[];
}

View File

@ -53,12 +53,6 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2
'ZeroOf<T>' 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'.
'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'.
Type 'number' is not assignable to type 'T'.
'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
Type 'string | number' is not assignable to type 'T'.
'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
Type 'string' is not assignable to type 'T'.
'string' 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<T>'.
Type 'string | number' is not assignable to type 'ZeroOf<T>'.
Type 'string' is not assignable to type 'ZeroOf<T>'.
@ -303,12 +297,6 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(288,43): error TS
!!! error TS2322: 'ZeroOf<T>' 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: 'T' could be instantiated with an arbitrary type which could be unrelated to '0 | (T extends string ? "" : false)'.
!!! error TS2322: Type 'number' is not assignable to type 'T'.
!!! error TS2322: 'number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
!!! error TS2322: Type 'string | number' is not assignable to type 'T'.
!!! error TS2322: 'string | number' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'string | number'.
!!! error TS2322: Type 'string' is not assignable to type 'T'.
!!! error TS2322: 'string' 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<T>'.

View File

@ -45,8 +45,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc
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' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Base' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Base'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance6.ts (7 errors) ====
@ -152,7 +150,5 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc
!!! 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' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2430: Type 'Base' is not assignable to type 'T'.
!!! error TS2430: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Base'.
a16: new (x: { a: T; b: T }) => T[];
}

View File

@ -0,0 +1,20 @@
tests/cases/compiler/doNotElaborateAssignabilityToTypeParameters.ts(3,3): error TS2322: Type 'T | Yadda' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'T | Yadda'.
==== tests/cases/compiler/doNotElaborateAssignabilityToTypeParameters.ts (1 errors) ====
async function foo<T>(x: T): Promise<T> {
let yaddable = await getXOrYadda(x);
return yaddable;
~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'T | Yadda' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'T | Yadda'.
}
interface Yadda {
stuff: string,
things: string,
}
declare function getXOrYadda<T>(x: T): T | Yadda;

View File

@ -0,0 +1,64 @@
//// [doNotElaborateAssignabilityToTypeParameters.ts]
async function foo<T>(x: T): Promise<T> {
let yaddable = await getXOrYadda(x);
return yaddable;
}
interface Yadda {
stuff: string,
things: string,
}
declare function getXOrYadda<T>(x: T): T | Yadda;
//// [doNotElaborateAssignabilityToTypeParameters.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
function foo(x) {
return __awaiter(this, void 0, void 0, function () {
var yaddable;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, getXOrYadda(x)];
case 1:
yaddable = _a.sent();
return [2 /*return*/, yaddable];
}
});
});
}

View File

@ -0,0 +1,36 @@
=== tests/cases/compiler/doNotElaborateAssignabilityToTypeParameters.ts ===
async function foo<T>(x: T): Promise<T> {
>foo : Symbol(foo, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 0, 0))
>T : Symbol(T, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 0, 19))
>x : Symbol(x, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 0, 22))
>T : Symbol(T, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 0, 19))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>T : Symbol(T, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 0, 19))
let yaddable = await getXOrYadda(x);
>yaddable : Symbol(yaddable, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 1, 5))
>getXOrYadda : Symbol(getXOrYadda, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 8, 1))
>x : Symbol(x, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 0, 22))
return yaddable;
>yaddable : Symbol(yaddable, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 1, 5))
}
interface Yadda {
>Yadda : Symbol(Yadda, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 3, 1))
stuff: string,
>stuff : Symbol(Yadda.stuff, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 5, 17))
things: string,
>things : Symbol(Yadda.things, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 6, 16))
}
declare function getXOrYadda<T>(x: T): T | Yadda;
>getXOrYadda : Symbol(getXOrYadda, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 8, 1))
>T : Symbol(T, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 10, 29))
>x : Symbol(x, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 10, 32))
>T : Symbol(T, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 10, 29))
>T : Symbol(T, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 10, 29))
>Yadda : Symbol(Yadda, Decl(doNotElaborateAssignabilityToTypeParameters.ts, 3, 1))

View File

@ -0,0 +1,28 @@
=== tests/cases/compiler/doNotElaborateAssignabilityToTypeParameters.ts ===
async function foo<T>(x: T): Promise<T> {
>foo : <T>(x: T) => Promise<T>
>x : T
let yaddable = await getXOrYadda(x);
>yaddable : T | Yadda
>await getXOrYadda(x) : T | Yadda
>getXOrYadda(x) : T | Yadda
>getXOrYadda : <T>(x: T) => T | Yadda
>x : T
return yaddable;
>yaddable : T | Yadda
}
interface Yadda {
stuff: string,
>stuff : string
things: string,
>things : string
}
declare function getXOrYadda<T>(x: T): T | Yadda;
>getXOrYadda : <T>(x: T) => T | Yadda
>x : T

View File

@ -4,8 +4,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts(8,56): error TS2322: Type 'U' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'T' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericCallWithObjectTypeArgsAndInitializers.ts (3 errors) ====
@ -26,6 +24,4 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/genericC
~~~~~~~~
!!! error TS2322: Type 'U' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2322: Type 'T' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
function foo7<T, U extends T, V extends U>(x: V, y: U = x) { } // should be ok

View File

@ -20,9 +20,6 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(41,5): error TS2
Type 'T[string]' is not assignable to type 'U[keyof T]'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
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'.
@ -32,12 +29,6 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(46,5): error TS2
Type 'T[string]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'T[keyof T]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'T[K]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(51,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(56,5): error TS2542: Index signature in type 'Readonly<T>' 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]'.
@ -162,9 +153,6 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! 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: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
}
function f13<T, U extends T, K extends keyof T>(x: T, y: Partial<U>, k: K) {
@ -181,12 +169,6 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
}
function f20<T>(x: T, y: Readonly<T>, k: keyof T) {

View File

@ -5,12 +5,6 @@ tests/cases/compiler/recursiveConditionalTypes.ts(20,5): error TS2322: Type 'Awa
tests/cases/compiler/recursiveConditionalTypes.ts(21,5): error TS2322: Type 'T' is not assignable to type 'Awaited<T>'.
tests/cases/compiler/recursiveConditionalTypes.ts(22,5): error TS2322: Type 'Awaited<T>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Awaited<T>'.
Type 'T | (T extends PromiseLike<infer U> ? Awaited<U> : T)' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'T | (T extends PromiseLike<infer U> ? Awaited<U> : T)'.
Type 'T extends PromiseLike<infer U> ? Awaited<U> : T' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'T extends PromiseLike<infer U> ? Awaited<U> : T'.
Type 'unknown' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.
tests/cases/compiler/recursiveConditionalTypes.ts(35,11): error TS2589: Type instantiation is excessively deep and possibly infinite.
tests/cases/compiler/recursiveConditionalTypes.ts(46,12): error TS2589: Type instantiation is excessively deep and possibly infinite.
tests/cases/compiler/recursiveConditionalTypes.ts(49,5): error TS2322: Type 'TupleOf<number, M>' is not assignable to type 'TupleOf<number, N>'.
@ -65,12 +59,6 @@ tests/cases/compiler/recursiveConditionalTypes.ts(116,9): error TS2345: Argument
~~
!!! error TS2322: Type 'Awaited<T>' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Awaited<T>'.
!!! error TS2322: Type 'T | (T extends PromiseLike<infer U> ? Awaited<U> : T)' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'T | (T extends PromiseLike<infer U> ? Awaited<U> : T)'.
!!! error TS2322: Type 'T extends PromiseLike<infer U> ? Awaited<U> : T' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'T extends PromiseLike<infer U> ? Awaited<U> : T'.
!!! error TS2322: Type 'unknown' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.
}
// Flattening arrays

View File

@ -6,8 +6,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2416: Property 'foo' in type 'D8<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
Type 'U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'V' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
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<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
Type 'V' is not assignable to type 'T'.
@ -113,8 +111,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D8<T, U, V>' is not assignable to the same property in base type 'C3<T>'.
!!! error TS2416: Type 'U' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2416: Type 'V' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
}
class D9<T extends U, U extends V, V> extends C3<U> {

View File

@ -2,45 +2,31 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(68,9): error TS2416: Property 'foo' in type 'D2<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
Type 'U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'Foo<T>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(73,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(73,9): error TS2416: Property 'foo' in type 'D3<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
Type 'V' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
Type 'Foo<V>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(78,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(78,9): error TS2416: Property 'foo' in type 'D4<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Foo<U>' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(88,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(88,9): error TS2416: Property 'foo' in type 'D6<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
Type 'V' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
Type 'Foo<V>' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(93,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(93,9): error TS2416: Property 'foo' in type 'D7<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
Type 'T' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Foo<U>' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(98,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(98,9): error TS2416: Property 'foo' in type 'D8<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
Type 'U' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'Foo<T>' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(115,9): error TS2416: Property 'foo' in type 'D1<T, U, V>' is not assignable to the same property in base type 'Base2<T>'.
Type 'T' is not assignable to type 'Foo<T>'.
Type 'Foo<U>' is not assignable to type 'Foo<T>'.
Type 'U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'Foo<T>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(120,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(125,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'T'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(125,9): error TS2416: Property 'foo' in type 'D3<T, U, V>' is not assignable to the same property in base type 'Base2<T>'.
@ -48,40 +34,30 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
Type 'Foo<V>' is not assignable to type 'Foo<T>'.
Type 'V' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
Type 'Foo<V>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(130,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(135,9): error TS2416: Property 'foo' in type 'D5<T, U, V>' is not assignable to the same property in base type 'Base2<U>'.
Type 'U' is not assignable to type 'Foo<U>'.
Type 'Foo<T>' is not assignable to type 'Foo<U>'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Foo<U>' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(140,9): error TS2411: Property 'foo' of type 'V' is not assignable to string index type 'U'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(140,9): error TS2416: Property 'foo' in type 'D6<T, U, V>' is not assignable to the same property in base type 'Base2<U>'.
Type 'V' is not assignable to type 'Foo<U>'.
Type 'Foo<V>' is not assignable to type 'Foo<U>'.
Type 'V' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
Type 'Foo<V>' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(145,9): error TS2411: Property 'foo' of type 'T' is not assignable to string index type 'V'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(145,9): error TS2416: Property 'foo' in type 'D7<T, U, V>' is not assignable to the same property in base type 'Base2<V>'.
Type 'T' is not assignable to type 'Foo<V>'.
Type 'Foo<U>' is not assignable to type 'Foo<V>'.
Type 'U' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'Foo<T>' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2411: Property 'foo' of type 'U' is not assignable to string index type 'V'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts(150,9): error TS2416: Property 'foo' in type 'D8<T, U, V>' is not assignable to the same property in base type 'Base2<V>'.
Type 'U' is not assignable to type 'Foo<V>'.
Type 'Foo<T>' is not assignable to type 'Foo<V>'.
Type 'T' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Foo<U>' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOfTypeParameterWithRecursiveConstraints.ts (24 errors) ====
@ -159,8 +135,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D2<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
!!! error TS2416: Type 'U' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
}
class D3<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<T> {
@ -172,8 +146,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D3<T, U, V>' is not assignable to the same property in base type 'Base<T>'.
!!! error TS2416: Type 'V' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
}
class D4<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<U> {
@ -185,8 +157,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D4<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
!!! error TS2416: Type 'T' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
}
class D5<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<U> {
@ -203,8 +173,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D6<T, U, V>' is not assignable to the same property in base type 'Base<U>'.
!!! error TS2416: Type 'V' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
}
class D7<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<V> {
@ -216,8 +184,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D7<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
!!! error TS2416: Type 'T' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
}
class D8<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<V> {
@ -229,8 +195,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Property 'foo' in type 'D8<T, U, V>' is not assignable to the same property in base type 'Base<V>'.
!!! error TS2416: Type 'U' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
}
class D9<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base<V> {
@ -254,8 +218,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'Foo<T>'.
!!! error TS2416: Type 'U' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
}
class D2<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<T> {
@ -276,8 +238,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'Foo<T>'.
!!! error TS2416: Type 'V' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'T'.
!!! error TS2416: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
}
class D4<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<U> {
@ -296,8 +256,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'Foo<U>'.
!!! error TS2416: Type 'T' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
}
class D6<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<U> {
@ -311,8 +269,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'Foo<U>'.
!!! error TS2416: Type 'V' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
!!! error TS2416: Type 'Foo<V>' is not assignable to type 'U'.
!!! error TS2416: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Foo<V>'.
}
class D7<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<V> {
@ -326,8 +282,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'Foo<V>'.
!!! error TS2416: Type 'U' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<T>'.
}
class D8<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<V> {
@ -341,8 +295,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypesOf
!!! error TS2416: Type 'Foo<T>' is not assignable to type 'Foo<V>'.
!!! error TS2416: Type 'T' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2416: Type 'Foo<U>' is not assignable to type 'V'.
!!! error TS2416: 'V' could be instantiated with an arbitrary type which could be unrelated to 'Foo<U>'.
}
class D9<T extends Foo<U>, U extends Foo<T>, V extends Foo<V>> extends Base2<V> {

View File

@ -45,8 +45,6 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW
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' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Base' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Base'.
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithConstructSignatures6.ts (7 errors) ====
@ -152,7 +150,5 @@ 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'. Two different types with this name exist, but they are unrelated.
!!! error TS2430: 'T' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2430: Type 'Base' is not assignable to type 'T'.
!!! error TS2430: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Base'.
a16: new (x: { a: T; b: T }) => T[];
}

View File

@ -4,8 +4,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(14,5): error TS2322: Type 'U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'V' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(17,5): error TS2322: Type 'V' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(20,5): error TS2322: Type 'V' is not assignable to type 'U'.
@ -54,8 +52,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(70,5): error TS2322: Type 'T' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'U' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typeParameterAssignability2.ts(71,5): error TS2322: Type 'U' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
@ -84,8 +80,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2322: Type 'V' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
u = t;
t = v; // error
@ -208,8 +202,6 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/typePara
~
!!! error TS2322: Type 'T' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2322: Type 'U' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
v = u; // error
~
!!! error TS2322: Type 'U' is not assignable to type 'V'.

View File

@ -1,13 +1,7 @@
tests/cases/compiler/typeParameterDiamond2.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
Type 'U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'U'.
tests/cases/compiler/typeParameterDiamond2.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
Type 'T | U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
Type 'U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'U'.
==== tests/cases/compiler/typeParameterDiamond2.ts (2 errors) ====
@ -22,17 +16,11 @@ tests/cases/compiler/typeParameterDiamond2.ts(10,13): error TS2322: Type 'Bottom
~~~
!!! error TS2322: Type 'T | U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
!!! error TS2322: Type 'U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'U'.
middle = bottom;
top = bottom;
~~~
!!! error TS2322: Type 'Bottom' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
!!! error TS2322: Type 'T | U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
!!! error TS2322: Type 'U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'U'.
}
}
}

View File

@ -1,24 +1,12 @@
tests/cases/compiler/typeParameterDiamond3.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
Type 'T' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
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'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Top'.
Type 'Bottom' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
Type 'Top | T | U' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
Type 'Top' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'Top'.
tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
Type 'Top | T | U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
Type 'T' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
==== tests/cases/compiler/typeParameterDiamond3.ts (3 errors) ====
@ -33,8 +21,6 @@ tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom
~~~
!!! error TS2322: Type 'T | U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
!!! error TS2322: Type 'T' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
middle = bottom;
~~~~~~
!!! error TS2322: Type 'Bottom' is not assignable to type 'T | U'.
@ -42,20 +28,10 @@ tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom
!!! error TS2322: Type 'Top' is not assignable to type 'T | U'.
!!! error TS2322: Type 'Top' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Top'.
!!! error TS2322: Type 'Bottom' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
!!! error TS2322: Type 'Top | T | U' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
!!! error TS2322: Type 'Top' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'Top'.
top = bottom;
~~~
!!! error TS2322: Type 'Bottom' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
!!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
!!! error TS2322: Type 'T' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
}
}
}

View File

@ -1,13 +1,7 @@
tests/cases/compiler/typeParameterDiamond4.ts(8,13): error TS2322: Type 'Top | T | U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
Type 'T' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/compiler/typeParameterDiamond4.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
Type 'Top | T | U' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
Type 'T' is not assignable to type 'Top'.
'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
==== tests/cases/compiler/typeParameterDiamond4.ts (2 errors) ====
@ -22,17 +16,11 @@ tests/cases/compiler/typeParameterDiamond4.ts(10,13): error TS2322: Type 'Bottom
~~~
!!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
!!! error TS2322: Type 'T' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
middle = bottom;
top = bottom;
~~~
!!! error TS2322: Type 'Bottom' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'Bottom'.
!!! error TS2322: Type 'Top | T | U' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'Top | T | U'.
!!! error TS2322: Type 'T' is not assignable to type 'Top'.
!!! error TS2322: 'Top' could be instantiated with an arbitrary type which could be unrelated to 'T'.
}
}
}

View File

@ -2,7 +2,6 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(4,5): error TS2322: Type
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Object'.
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) ====
@ -17,7 +16,6 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type
~
!!! error TS2322: Type 'Object' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to '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
}

View File

@ -6,17 +6,12 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(5,5): error TS2322: Type
'T' could be instantiated with an arbitrary type which could be unrelated to 'V'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(6,5): error TS2322: Type 'T' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
Type 'Date' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'Date'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(7,5): error TS2322: Type 'V' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'V'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(8,5): error TS2322: Type 'U' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
Type 'Date' is not assignable to type 'V'.
'V' could be instantiated with an arbitrary type which could be unrelated to 'Date'.
tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type 'Object' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'Object'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
==== tests/cases/compiler/typeParametersShouldNotBeEqual2.ts (6 errors) ====
@ -37,8 +32,6 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type
~
!!! error TS2322: Type 'T' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'T'.
!!! error TS2322: Type 'Date' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'Date'.
y = z; // Error
~
!!! error TS2322: Type 'V' is not assignable to type 'U'.
@ -47,13 +40,10 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type
~
!!! error TS2322: Type 'U' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! error TS2322: Type 'Date' is not assignable to type 'V'.
!!! error TS2322: 'V' could be instantiated with an arbitrary type which could be unrelated to 'Date'.
x = zz; // Error
~
!!! error TS2322: Type 'Object' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'Object'.
!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
zz = x; // Ok
}

View File

@ -24,12 +24,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(70,5): error TS2322: Type 'T | U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
Type 'U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts(71,5): error TS2322: Type 'T | U' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
Type 'T' is not assignable to type 'U'.
'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTypesAssignability.ts (19 errors) ====
@ -151,13 +147,9 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/unionTyp
~
!!! error TS2322: Type 'T | U' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
u = x; // error T not assignable to U
~
!!! error TS2322: Type 'T | U' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T | U'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: 'U' could be instantiated with an arbitrary type which could be unrelated to 'T'.
}

View File

@ -0,0 +1,13 @@
// @lib: es2015
// @target: ES5
async function foo<T>(x: T): Promise<T> {
let yaddable = await getXOrYadda(x);
return yaddable;
}
interface Yadda {
stuff: string,
things: string,
}
declare function getXOrYadda<T>(x: T): T | Yadda;