Merge pull request #1747 from Microsoft/elaborateErrorsOnce

Elaborate relational errors at least once when reporting them
This commit is contained in:
Ryan Cavanaugh 2015-01-29 15:25:29 -08:00
commit feda58d601
59 changed files with 542 additions and 27 deletions

View file

@ -3408,9 +3408,9 @@ module ts {
// TYPE CHECKING
var subtypeRelation: Map<boolean> = {};
var assignableRelation: Map<boolean> = {};
var identityRelation: Map<boolean> = {};
var subtypeRelation: Map<RelationComparisonResult> = {};
var assignableRelation: Map<RelationComparisonResult> = {};
var identityRelation: Map<RelationComparisonResult> = {};
function isTypeIdenticalTo(source: Type, target: Type): boolean {
return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined);
@ -3445,7 +3445,7 @@ module ts {
function checkTypeRelatedTo(
source: Type,
target: Type,
relation: Map<boolean>,
relation: Map<RelationComparisonResult>,
errorNode: Node,
headMessage?: DiagnosticMessage,
containingMessageChain?: DiagnosticMessageChain): boolean {
@ -3453,7 +3453,7 @@ module ts {
var errorInfo: DiagnosticMessageChain;
var sourceStack: ObjectType[];
var targetStack: ObjectType[];
var maybeStack: Map<boolean>[];
var maybeStack: Map<RelationComparisonResult>[];
var expandingFlags: number;
var depth = 0;
var overflow = false;
@ -3465,6 +3465,14 @@ module ts {
error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
}
else if (errorInfo) {
// If we already computed this relation, but in a context where we didn't want to report errors (e.g. overload resolution),
// then we'll only have a top-level error (e.g. 'Class X does not implement interface Y') without any details. If this happened,
// request a recompuation to get a complete error message. This will be skipped if we've already done this computation in a context
// where errors were being reported.
if (errorInfo.next === undefined) {
errorInfo = undefined;
isRelatedTo(source, target, errorNode !== undefined, headMessage, /* elaborateErrors */ true);
}
if (containingMessageChain) {
errorInfo = concatenateDiagnosticMessageChains(containingMessageChain, errorInfo);
}
@ -3480,7 +3488,7 @@ module ts {
// Ternary.True if they are related with no assumptions,
// Ternary.Maybe if they are related with assumptions of other relationships, or
// Ternary.False if they are not related.
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage, elaborateErrors = false): Ternary {
var result: Ternary;
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
if (source === target) return Ternary.True;
@ -3547,7 +3555,7 @@ module ts {
// identity relation does not use apparent type
var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source);
if (sourceOrApparentType.flags & TypeFlags.ObjectType && target.flags & TypeFlags.ObjectType &&
(result = objectTypeRelatedTo(sourceOrApparentType, <ObjectType>target, reportStructuralErrors))) {
(result = objectTypeRelatedTo(sourceOrApparentType, <ObjectType>target, reportStructuralErrors, elaborateErrors))) {
errorInfo = saveErrorInfo;
return result;
}
@ -3638,14 +3646,19 @@ module ts {
// Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are
// equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion
// and issue an error. Otherwise, actually compare the structure of the two types.
function objectTypeRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean): Ternary {
function objectTypeRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean, elaborateErrors = false): Ternary {
if (overflow) {
return Ternary.False;
}
var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id;
var related = relation[id];
//var related: RelationComparisonResult = undefined; // relation[id];
if (related !== undefined) {
return related ? Ternary.True : Ternary.False;
// If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate
// errors, we can use the cached value. Otherwise, recompute the relation
if (!elaborateErrors || (related === RelationComparisonResult.FailedAndReported)) {
return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False;
}
}
if (depth > 0) {
for (var i = 0; i < depth; i++) {
@ -3668,7 +3681,7 @@ module ts {
sourceStack[depth] = source;
targetStack[depth] = target;
maybeStack[depth] = {};
maybeStack[depth][id] = true;
maybeStack[depth][id] = RelationComparisonResult.Succeeded;
depth++;
var saveExpandingFlags = expandingFlags;
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) expandingFlags |= 1;
@ -3696,13 +3709,13 @@ module ts {
if (result) {
var maybeCache = maybeStack[depth];
// If result is definitely true, copy assumptions to global cache, else copy to next level up
var destinationCache = result === Ternary.True || depth === 0 ? relation : maybeStack[depth - 1];
copyMap(/*source*/maybeCache, /*target*/destinationCache);
var destinationCache = (result === Ternary.True || depth === 0) ? relation : maybeStack[depth - 1];
copyMap(maybeCache, destinationCache);
}
else {
// A false result goes straight into global cache (when something is false under assumptions it
// will also be false without assumptions)
relation[id] = false;
relation[id] = reportErrors ? RelationComparisonResult.FailedAndReported : RelationComparisonResult.Failed;
}
return result;
}
@ -5949,7 +5962,7 @@ module ts {
return typeArgumentsAreAssignable;
}
function checkApplicableSignature(node: CallLikeExpression, args: Node[], signature: Signature, relation: Map<boolean>, excludeArgument: boolean[], reportErrors: boolean) {
function checkApplicableSignature(node: CallLikeExpression, args: Node[], signature: Signature, relation: Map<RelationComparisonResult>, excludeArgument: boolean[], reportErrors: boolean) {
for (var i = 0; i < args.length; i++) {
var arg = args[i];
var argType: Type;
@ -6173,7 +6186,7 @@ module ts {
return resolveErrorCall(node);
function chooseOverload(candidates: Signature[], relation: Map<boolean>) {
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>) {
for (var i = 0; i < candidates.length; i++) {
if (!hasCorrectArity(node, args, candidates[i])) {
continue;

View file

@ -330,6 +330,12 @@ module ts {
HasAggregatedChildData = 1 << 6
}
export const enum RelationComparisonResult {
Succeeded = 1, // Should be truthy
Failed = 2,
FailedAndReported = 3
}
export interface Node extends TextRange {
kind: SyntaxKind;
flags: NodeFlags;

View file

@ -1,4 +1,5 @@
tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'.
Property 'length' is missing in type 'B'.
==== tests/cases/compiler/arrayAssignmentTest3.ts (1 errors) ====
@ -16,5 +17,6 @@ tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of t
var xx = new a(null, 7, new B());
~~~~~~~
!!! error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'.
!!! error TS2345: Property 'length' is missing in type 'B'.

View file

@ -3,7 +3,10 @@ tests/cases/compiler/assignmentCompatBug5.ts(2,6): error TS2345: Argument of typ
tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
Types of parameters 's' and 'n' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
Type 'void' is not assignable to type 'number'.
==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ====
@ -23,8 +26,11 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ
foo3((s:string) => { });
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
!!! error TS2345: Types of parameters 's' and 'n' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
foo3((n) => { return; });
~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
!!! error TS2345: Type 'void' is not assignable to type 'number'.

View file

@ -1,4 +1,5 @@
tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts(15,5): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'.
Index signature is missing in type 'Foo'.
==== tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts (1 errors) ====
@ -19,4 +20,5 @@ tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts(15,5):
Biz(new Foo());
~~~~~~~~~
!!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'.
!!! error TS2345: Index signature is missing in type 'Foo'.

View file

@ -1,4 +1,5 @@
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,59): error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'.
Type 'B' is not assignable to type 'C'.
==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ====
@ -22,4 +23,5 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
// Ok to go down the chain, but error to try to climb back up
(new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A);
~~~~~~~~~~
!!! error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'.
!!! error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'.
!!! error TS2345: Type 'B' is not assignable to type 'C'.

View file

@ -1,5 +1,7 @@
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(7,43): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
Type 'T' is not assignable to type 'S'.
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,29): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
Type 'T' is not assignable to type 'S'.
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type 'string' is not assignable to type 'number'.
@ -15,11 +17,13 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
(new Chain(t)).then(tt => s).then(ss => t);
~~~~~~~
!!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
!!! error TS2345: Type 'T' is not assignable to type 'S'.
// But error to try to climb up the chain
(new Chain(s)).then(ss => t);
~~~~~~~
!!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'.
!!! error TS2345: Type 'T' is not assignable to type 'S'.
// Staying at T or S should be fine
(new Chain(t)).then(tt => t).then(tt => t).then(tt => t);

View file

@ -1,5 +1,7 @@
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(16,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
Type 'string' is not assignable to type 'Date'.
tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
Type 'string' is not assignable to type 'Date'.
==== tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts (2 errors) ====
@ -21,7 +23,9 @@ tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32):
var r5 = _.forEach<number>(c2, f);
~
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
var r6 = _.forEach<number>(c2, (x) => { return x.toFixed() });
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'.
!!! error TS2345: Type 'string' is not assignable to type 'Date'.

View file

@ -1,6 +1,7 @@
tests/cases/compiler/contextualTypingOfObjectLiterals.ts(4,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }'.
Index signature is missing in type '{ x: string; }'.
tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.
Index signature is missing in type '{ x: string; }'.
==== tests/cases/compiler/contextualTypingOfObjectLiterals.ts (2 errors) ====
@ -18,4 +19,5 @@ tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Ar
f(obj1); // Ok
f(obj2); // Error - indexer doesn't match
~~~~
!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.
!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'.
!!! error TS2345: Index signature is missing in type '{ x: string; }'.

View file

@ -6,6 +6,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(9
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(13,21): error TS2339: Property 'b' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(17,21): error TS2339: Property 'c' does not exist on type 'C1'.
tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(21,27): error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'.
Types of property '2' are incompatible.
Type 'string' is not assignable to type 'boolean'.
==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts (8 errors) ====
@ -46,6 +48,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(2
var x = new C1(undefined, [0, undefined, ""]);
~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'.
!!! error TS2345: Types of property '2' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'boolean'.
var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
var y = new C1(10, [0, "", true]);

View file

@ -0,0 +1,52 @@
tests/cases/compiler/elaboratedErrors.ts(10,7): error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'.
Types of property 'read' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/elaboratedErrors.ts(20,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
Property 'x' is missing in type 'Beta'.
tests/cases/compiler/elaboratedErrors.ts(21,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
tests/cases/compiler/elaboratedErrors.ts(24,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
Property 'y' is missing in type 'Alpha'.
tests/cases/compiler/elaboratedErrors.ts(25,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
==== tests/cases/compiler/elaboratedErrors.ts (5 errors) ====
interface FileSystem {
read: number;
}
function fn(s: WorkerFS): void;
function fn(s: FileSystem): void;
function fn(s: FileSystem|WorkerFS) { }
// This should issue a large error, not a small one
class WorkerFS implements FileSystem {
~~~~~~~~
!!! error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'.
!!! error TS2420: Types of property 'read' are incompatible.
!!! error TS2420: Type 'string' is not assignable to type 'number'.
read: string;
}
interface Alpha { x: string; }
interface Beta { y: number; }
var x: Alpha;
var y: Beta;
// Only one of these errors should be large
x = y;
~
!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
!!! error TS2322: Property 'x' is missing in type 'Beta'.
x = y;
~
!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
// Only one of these errors should be large
y = x;
~
!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
!!! error TS2322: Property 'y' is missing in type 'Alpha'.
y = x;
~
!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'.

View file

@ -0,0 +1,45 @@
//// [elaboratedErrors.ts]
interface FileSystem {
read: number;
}
function fn(s: WorkerFS): void;
function fn(s: FileSystem): void;
function fn(s: FileSystem|WorkerFS) { }
// This should issue a large error, not a small one
class WorkerFS implements FileSystem {
read: string;
}
interface Alpha { x: string; }
interface Beta { y: number; }
var x: Alpha;
var y: Beta;
// Only one of these errors should be large
x = y;
x = y;
// Only one of these errors should be large
y = x;
y = x;
//// [elaboratedErrors.js]
function fn(s) {
}
// This should issue a large error, not a small one
var WorkerFS = (function () {
function WorkerFS() {
}
return WorkerFS;
})();
var x;
var y;
// Only one of these errors should be large
x = y;
x = y;
// Only one of these errors should be large
y = x;
y = x;

View file

@ -1,4 +1,5 @@
tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
Property 'a' is missing in type 'Boolean'.
==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ====
@ -6,6 +7,7 @@ tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument o
var x = new foo(true); // Should error
~~~~
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'.
!!! error TS2345: Property 'a' is missing in type 'Boolean'.
var y = new foo({a: "test", b: 42}); // Should be OK
var z: number = y.test.b;
==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ====

View file

@ -1,5 +1,6 @@
tests/cases/compiler/functionCall7.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
Property 'a' is missing in type 'Number'.
tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
@ -14,6 +15,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do
foo(4);
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'.
!!! error TS2345: Property 'a' is missing in type 'Number'.
foo();
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.

View file

@ -1,8 +1,11 @@
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
Property 'apply' is missing in type 'Number'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string[]' is not assignable to type 'string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '<U, V>(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'.
@ -11,6 +14,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
Type 'void' is not assignable to type 'string'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.
@ -22,6 +26,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
foo(1);
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'.
!!! error TS2345: Property 'apply' is missing in type 'Number'.
foo(() => { }, 1);
~~~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
@ -49,6 +54,8 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
var r2 = foo2((x: string[]) => x);
~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'string[]' is not assignable to type 'string'.
var r6 = foo2(C);
~
!!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
@ -78,6 +85,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
foo2(x);
~
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type 'void' is not assignable to type 'string'.
foo2(y);
~
!!! error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'.

View file

@ -1,7 +1,15 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(24,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(53,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(69,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(85,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'.
Type 'Promise<number>' is not assignable to type 'Promise<boolean>'.
Type 'number' is not assignable to type 'boolean'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ====
@ -31,6 +39,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
var newPromise = numPromise.then(testFunction);
~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
}
//////////////////////////////////////
@ -62,6 +72,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
var newPromise = numPromise.then(testFunction);
~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
}
//////////////////////////////////////
@ -80,6 +92,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
var newPromise = numPromise.then(testFunction);
~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
}
//////////////////////////////////////
@ -98,5 +112,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl
var newPromise = numPromise.then(testFunction);
~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<boolean>'.
!!! error TS2345: Type 'number' is not assignable to type 'boolean'.
}

View file

@ -1,5 +1,6 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(3,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
Property 'toDateString' is missing in type 'Number'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (2 errors) ====
@ -18,4 +19,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon
var r4 = foo<Date, Date>(1); // error
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'.
!!! error TS2345: Property 'toDateString' is missing in type 'Number'.
var r5 = foo<Date, Date>(new Date()); // no error

View file

@ -1,5 +1,9 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: new <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'.
Types of property 'cb' are incompatible.
Type 'new <T>(x: T, y: T) => string' is not assignable to type 'new (t: any) => string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(13,14): error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'.
Types of property 'cb' are incompatible.
Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts (2 errors) ====
@ -16,10 +20,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon
var r2 = foo(arg2); // error
~~~~
!!! error TS2345: Argument of type '{ cb: new <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'.
!!! error TS2345: Types of property 'cb' are incompatible.
!!! error TS2345: Type 'new <T>(x: T, y: T) => string' is not assignable to type 'new (t: any) => string'.
var arg3: { cb: new (x: string, y: number) => string };
var r3 = foo(arg3); // error
~~~~
!!! error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'.
!!! error TS2345: Types of property 'cb' are incompatible.
!!! error TS2345: Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'.
function foo2<T, U>(arg: { cb: new(t: T, t2: T) => U }) {
return new arg.cb(null, null);

View file

@ -1,7 +1,9 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
Property 'y' is missing in type '{ x: number; z?: number; }'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(19,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
Property 'z' is missing in type '{ x: number; y?: number; }'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts (2 errors) ====
@ -26,10 +28,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
!!! error TS2453: Property 'y' is missing in type '{ x: number; z?: number; }'.
var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b
~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
!!! error TS2453: Property 'z' is missing in type '{ x: number; y?: number; }'.
function other<T>(x: T) {
var r6 = foo((a: T) => a, (b: T) => b); // T => T

View file

@ -3,10 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' 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 'T' is not assignable to type 'Date'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,36): error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'.
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'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' 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.
Type 'T' is not assignable to type 'Date'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,51): error TS2304: Cannot find name 'U'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,57): error TS2304: Cannot find name 'U'.
@ -46,6 +51,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
var r7 = foo2((a: T) => a, (b: T) => b); // error
~~~~~~~~~~~
!!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
!!! error TS2345: Types of parameters 'a' and 'x' are incompatible.
!!! error TS2345: Type 'T' is not assignable to type 'Date'.
var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date
}
@ -60,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error
~~~~~~~~~~
!!! error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'.
!!! error TS2345: Type 'F' is not assignable to type 'E'.
}
module TU {
@ -89,6 +97,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
var r7 = foo2((a: T) => a, (b: T) => b);
~~~~~~~~~~~
!!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'.
!!! error TS2345: Types of parameters 'a' and 'x' are incompatible.
!!! error TS2345: Type 'T' is not assignable to type 'Date'.
var r7b = foo2((a) => a, (b) => b);
}

View file

@ -1,5 +1,6 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(32,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'.
Type 'boolean' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'.
@ -40,6 +41,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen
~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'.
!!! error TS2453: Type 'boolean' is not assignable to type 'string'.
var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error
~~~~
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.

View file

@ -1,7 +1,9 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(12,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
Property 'y' is missing in type '{ x: number; z?: number; }'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(13,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
Property 'z' is missing in type '{ x: number; y?: number; }'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts (2 errors) ====
@ -20,10 +22,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNon
~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'.
!!! error TS2453: Property 'y' is missing in type '{ x: number; z?: number; }'.
var r2 = foo(b, a); // { x: number; z?: number; };
~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'.
!!! error TS2453: Property 'z' is missing in type '{ x: number; y?: number; }'.
var x: { x: number; };
var y: { x?: number; };

View file

@ -1,5 +1,6 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts(20,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'.
Types have separate declarations of a private property 'x'.
==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts (1 errors) ====
@ -26,4 +27,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj
~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'.
!!! error TS2453: Types have separate declarations of a private property 'x'.
var r2 = foo(c1, c1); // ok

View file

@ -1,5 +1,6 @@
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'.
Property 'y' is missing in type 'Derived2'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(20,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
@ -25,6 +26,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj
~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'.
!!! error TS2453: Property 'y' is missing in type 'Derived2'.
function f2<T extends Base, U extends { x: T; y: T }>(a: U) {
~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -1,5 +1,7 @@
tests/cases/compiler/genericCombinators2.ts(15,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
Type 'string' is not assignable to type 'Date'.
tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
Type 'string' is not assignable to type 'Date'.
==== tests/cases/compiler/genericCombinators2.ts (2 errors) ====
@ -20,6 +22,8 @@ tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of ty
var r5a = _.map<number, string, Date>(c2, (x, y) => { return x.toFixed() });
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
!!! error TS2345: Type 'string' is not assignable to type 'Date'.
var r5b = _.map<number, string, Date>(c2, rf1);
~~~
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'.
!!! error TS2345: Type 'string' is not assignable to type 'Date'.

View file

@ -2,6 +2,7 @@ tests/cases/compiler/genericConstraint2.ts(5,18): error TS2313: Constraint of a
tests/cases/compiler/genericConstraint2.ts(11,7): error TS2420: Class 'ComparableString' incorrectly implements interface 'Comparable<string>'.
Property 'comparer' is missing in type 'ComparableString'.
tests/cases/compiler/genericConstraint2.ts(21,17): error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable<any>'.
Property 'comparer' is missing in type 'ComparableString'.
==== tests/cases/compiler/genericConstraint2.ts (3 errors) ====
@ -32,4 +33,5 @@ tests/cases/compiler/genericConstraint2.ts(21,17): error TS2344: Type 'Comparabl
var b = new ComparableString("b");
var c = compare<ComparableString>(a, b);
~~~~~~~~~~~~~~~~
!!! error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable<any>'.
!!! error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable<any>'.
!!! error TS2344: Property 'comparer' is missing in type 'ComparableString'.

View file

@ -4,6 +4,7 @@ tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 's
tests/cases/compiler/genericRestArgs.ts(10,12): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'.
tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
Property 'length' is missing in type 'Number'.
==== tests/cases/compiler/genericRestArgs.ts (4 errors) ====
@ -28,4 +29,5 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type '
var a2Gb = makeArrayG<any>(1, "");
var a2Gc = makeArrayG<any[]>(1, ""); // error
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'.
!!! error TS2345: Property 'length' is missing in type 'Number'.

View file

@ -15,6 +15,8 @@ tests/cases/compiler/incompatibleTypes.ts(33,7): error TS2420: Class 'C4' incorr
Type '{ c: { b: string; }; d: string; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
Property 'a' is missing in type '{ c: { b: string; }; d: string; }'.
tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'.
Types of property 'p1' are incompatible.
Type '() => string' is not assignable to type '(s: string) => number'.
tests/cases/compiler/incompatibleTypes.ts(49,5): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'.
Property 'c' is missing in type '{ e: number; f: number; }'.
tests/cases/compiler/incompatibleTypes.ts(66,5): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
@ -88,6 +90,8 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
if1(c1);
~~
!!! error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'.
!!! error TS2345: Types of property 'p1' are incompatible.
!!! error TS2345: Type '() => string' is not assignable to type '(s: string) => number'.
function of1(n: { a: { a: string; }; b: string; }): number;

View file

@ -1,4 +1,5 @@
tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts(18,27): error TS2345: Argument of type 'NumberMap<Function>' is not assignable to parameter of type 'StringMap<{}>'.
Index signature is missing in type 'NumberMap<Function>'.
==== tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts (1 errors) ====
@ -22,5 +23,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureType
var v1 = stringMapToArray(numberMap); // Error expected here
~~~~~~~~~
!!! error TS2345: Argument of type 'NumberMap<Function>' is not assignable to parameter of type 'StringMap<{}>'.
!!! error TS2345: Index signature is missing in type 'NumberMap<Function>'.
var v1 = stringMapToArray(stringMap); // Ok

View file

@ -1,6 +1,9 @@
tests/cases/compiler/interfaceAssignmentCompat.ts(32,18): error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'.
Types of parameters 'a' and 'a' are incompatible.
Type 'IFrenchEye' is not assignable to type 'IEye'.
tests/cases/compiler/interfaceAssignmentCompat.ts(37,29): error TS2339: Property '_map' does not exist on type 'typeof Color'.
tests/cases/compiler/interfaceAssignmentCompat.ts(42,13): error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'.
Property 'coleur' is missing in type 'IEye'.
tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]'.
Type 'IEye' is not assignable to type 'IFrenchEye'.
@ -40,6 +43,8 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy
x=x.sort(CompareYeux); // parameter mismatch
~~~~~~~~~~~
!!! error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'.
!!! error TS2345: Types of parameters 'a' and 'a' are incompatible.
!!! error TS2345: Type 'IFrenchEye' is not assignable to type 'IEye'.
// type of z inferred from specialized array type
var z=x.sort(CompareEyes); // ok
@ -54,6 +59,7 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy
eeks[j]=z[j]; // nope: element assignment
~~~~~~~
!!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'.
!!! error TS2322: Property 'coleur' is missing in type 'IEye'.
}
eeks=z; // nope: array assignment
~~~~

View file

@ -1,5 +1,6 @@
tests/cases/compiler/maxConstraints.ts(5,6): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<any>'.
Property 'compareTo' is missing in type 'Number'.
==== tests/cases/compiler/maxConstraints.ts (2 errors) ====
@ -14,4 +15,5 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'nu
var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y };
var maxResult = max2(1, 2);
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<any>'.
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable<any>'.
!!! error TS2345: Property 'compareTo' is missing in type 'Number'.

View file

@ -1,4 +1,5 @@
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesFunctionArgument2.ts(7,5): error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ a: string; id: number; }'.
Property 'a' is missing in type '{ name: string; id: number; }'.
==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesFunctionArgument2.ts (1 errors) ====
@ -11,4 +12,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
foo(person); // error
~~~~~~
!!! error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ a: string; id: number; }'.
!!! error TS2345: Property 'a' is missing in type '{ name: string; id: number; }'.

View file

@ -1,5 +1,7 @@
tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(2,14): error TS2463: A binding pattern parameter cannot be optional in an implementation signature.
tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
Types of property '0' are incompatible.
Type 'boolean' is not assignable to type 'string'.
==== tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts (2 errors) ====
@ -14,4 +16,6 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): er
foo([false, 0, ""]);
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
!!! error TS2345: Types of property '0' are incompatible.
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.

View file

@ -1,4 +1,6 @@
tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts(9,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
Types of property '0' are incompatible.
Type 'boolean' is not assignable to type 'string'.
==== tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts (1 errors) ====
@ -12,4 +14,6 @@ tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.
foo([false, 0, ""]);
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'.
!!! error TS2345: Types of property '0' are incompatible.
!!! error TS2345: Type 'boolean' is not assignable to type 'string'.

View file

@ -1,8 +1,10 @@
tests/cases/compiler/overloadResolutionOverCTLambda.ts(2,5): error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'.
Type 'number' is not assignable to type 'boolean'.
==== tests/cases/compiler/overloadResolutionOverCTLambda.ts (1 errors) ====
function foo(b: (item: number) => boolean) { }
foo(a => a); // can not convert (number)=>bool to (number)=>number
~~~~~~
!!! error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'.
!!! error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'.
!!! error TS2345: Type 'number' is not assignable to type 'boolean'.

View file

@ -1,8 +1,11 @@
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,5): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,37): error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'.
Property 'x' is missing in type 'D'.
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,5): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'.
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2345: Argument of type '(x: D) => G<D>' is not assignable to parameter of type '(x: B) => any'.
Types of parameters 'x' and 'x' are incompatible.
Type 'D' is not assignable to type 'B'.
tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): error TS2344: Type 'D' does not satisfy the constraint 'A'.
@ -25,6 +28,7 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12):
!!! error TS2322: Type 'string' is not assignable to type 'number'.
~
!!! error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'.
!!! error TS2345: Property 'x' is missing in type 'D'.
var result2: number = foo(x => new G<typeof x>(x)); // x has type D, new G(x) fails, so first overload is picked.
~~~~~~~
@ -43,4 +47,6 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12):
});
~
!!! error TS2345: Argument of type '(x: D) => G<D>' is not assignable to parameter of type '(x: B) => any'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'D' is not assignable to type 'B'.

View file

@ -1,6 +1,8 @@
tests/cases/compiler/overloadsWithProvisionalErrors.ts(6,6): error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
Type '{}' is not assignable to type '{ a: number; b: number; }'.
tests/cases/compiler/overloadsWithProvisionalErrors.ts(7,17): error TS2304: Cannot find name 'blah'.
tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,6): error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
Type '{ a: any; }' is not assignable to type '{ a: number; b: number; }'.
tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cannot find name 'blah'.
@ -13,11 +15,13 @@ tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cann
func(s => ({})); // Error for no applicable overload (object type is missing a and b)
~~~~~~~~~
!!! error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
!!! error TS2345: Type '{}' is not assignable to type '{ a: number; b: number; }'.
func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error)
~~~~
!!! error TS2304: Cannot find name 'blah'.
func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway
~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
!!! error TS2345: Type '{ a: any; }' is not assignable to type '{ a: number; b: number; }'.
~~~~
!!! error TS2304: Cannot find name 'blah'.

View file

@ -1,5 +1,7 @@
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(7,5): error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
Type '(x: string) => string' is not assignable to type 'string'.
tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(8,5): error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
Type '(x: string) => string' is not assignable to type 'string'.
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts (2 errors) ====
@ -12,7 +14,9 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(8,5):
foo(() => g);
~~~~~~~
!!! error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type '(x: string) => string' is not assignable to type 'string'.
foo(x);
~
!!! error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
!!! error TS2345: Type '(x: string) => string' is not assignable to type 'string'.

View file

@ -1,4 +1,5 @@
tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
Type 'string' is not assignable to type 'Function'.
==== tests/cases/compiler/promiseChaining1.ts (1 errors) ====
@ -11,6 +12,7 @@ tests/cases/compiler/promiseChaining1.ts(7,50): error TS2345: Argument of type '
var z = this.then(x => result)/*S*/.then(x => "abc")/*Function*/.then(x => x.length)/*number*/; // Should error on "abc" because it is not a Function
~~~~~~~~~~
!!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
!!! error TS2345: Type 'string' is not assignable to type 'Function'.
return new Chain2(result);
}
}

View file

@ -1,4 +1,5 @@
tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
Type 'string' is not assignable to type 'Function'.
==== tests/cases/compiler/promiseChaining2.ts (1 errors) ====
@ -11,6 +12,7 @@ tests/cases/compiler/promiseChaining2.ts(7,45): error TS2345: Argument of type '
var z = this.then(x => result).then(x => "abc").then(x => x.length);
~~~~~~~~~~
!!! error TS2345: Argument of type '(x: S) => string' is not assignable to parameter of type '(x: S) => Function'.
!!! error TS2345: Type 'string' is not assignable to type 'Function'.
return new Chain2(result);
}
}

View file

@ -1,8 +1,18 @@
tests/cases/compiler/promisePermutations.ts(74,70): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'IPromise<number>'.
tests/cases/compiler/promisePermutations.ts(79,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(84,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(88,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
@ -12,9 +22,17 @@ tests/cases/compiler/promisePermutations.ts(100,19): error TS2345: Argument of t
tests/cases/compiler/promisePermutations.ts(101,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
tests/cases/compiler/promisePermutations.ts(102,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations.ts(106,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(109,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(110,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(111,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(117,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
tests/cases/compiler/promisePermutations.ts(121,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
@ -34,10 +52,19 @@ tests/cases/compiler/promisePermutations.ts(144,12): error TS2453: The type argu
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/promisePermutations.ts(152,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
Types of property 'then' are incompatible.
Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
tests/cases/compiler/promisePermutations.ts(156,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(158,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
==== tests/cases/compiler/promisePermutations.ts (33 errors) ====
@ -117,6 +144,8 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
var r4: IPromise<string>;
var sIPromise: (x: any) => IPromise<string>;
@ -124,17 +153,25 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
var s4: Promise<string>;
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
var r5: IPromise<string>;
@ -175,17 +212,25 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
var s7: Promise<string>;
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
var r8: IPromise<number>;
@ -258,22 +303,31 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t
~~~~~~~~
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
!!! error TS2453: Types of property 'then' are incompatible.
!!! error TS2453: Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
var r11: IPromise<number>;
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11: Promise<number>;
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // error
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
var r12 = testFunction12(x => x);
var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok

View file

@ -1,8 +1,18 @@
tests/cases/compiler/promisePermutations2.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'IPromise<number>'.
tests/cases/compiler/promisePermutations2.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations2.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations2.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
@ -12,9 +22,17 @@ tests/cases/compiler/promisePermutations2.ts(99,19): error TS2345: Argument of t
tests/cases/compiler/promisePermutations2.ts(100,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
tests/cases/compiler/promisePermutations2.ts(101,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations2.ts(105,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(108,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(109,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(110,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(116,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
tests/cases/compiler/promisePermutations2.ts(120,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
@ -34,10 +52,19 @@ tests/cases/compiler/promisePermutations2.ts(143,12): error TS2453: The type arg
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/promisePermutations2.ts(151,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
Types of property 'then' are incompatible.
Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '<U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise<U>'.
tests/cases/compiler/promisePermutations2.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
==== tests/cases/compiler/promisePermutations2.ts (33 errors) ====
@ -116,6 +143,8 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3); // Should error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
var r4: IPromise<string>;
var sIPromise: (x: any) => IPromise<string>;
@ -123,17 +152,25 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
var s4: Promise<string>;
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
var r5: IPromise<string>;
@ -174,17 +211,25 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
var s7: Promise<string>;
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
var r8: IPromise<number>;
@ -257,22 +302,31 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
~~~~~~~~
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
!!! error TS2453: Types of property 'then' are incompatible.
!!! error TS2453: Type '{ <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => IPromise<U>, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => IPromise<U>, progress?: (progress: any) => void): IPromise<U>; <U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise<U>; }' is not assignable to type '<U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise<U>'.
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
var r11: IPromise<number>;
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11: Promise<number>;
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // ok
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // ok
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
var r12 = testFunction12(x => x);
var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok

View file

@ -1,9 +1,21 @@
tests/cases/compiler/promisePermutations3.ts(68,69): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'IPromise<number>'.
tests/cases/compiler/promisePermutations3.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'IPromise<number>'.
tests/cases/compiler/promisePermutations3.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'x' and 'value' are incompatible.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations3.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations3.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
@ -13,9 +25,17 @@ tests/cases/compiler/promisePermutations3.ts(99,19): error TS2345: Argument of t
tests/cases/compiler/promisePermutations3.ts(100,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
tests/cases/compiler/promisePermutations3.ts(101,19): error TS2345: Argument of type '(x: number, cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
tests/cases/compiler/promisePermutations3.ts(105,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(108,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(109,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(110,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Type '<T>(a: T) => T' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(116,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
tests/cases/compiler/promisePermutations3.ts(119,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => IPromise<T>' is not assignable to parameter of type '(value: number) => IPromise<number>'.
tests/cases/compiler/promisePermutations3.ts(120,19): error TS2345: Argument of type '<T>(x: T, cb: (a: T) => T) => Promise<T>' is not assignable to parameter of type '(value: number) => Promise<number>'.
@ -35,11 +55,21 @@ tests/cases/compiler/promisePermutations3.ts(143,12): error TS2453: The type arg
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/promisePermutations3.ts(151,12): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
Types of property 'then' are incompatible.
Type '<U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise<U>' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
tests/cases/compiler/promisePermutations3.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(157,21): error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(158,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
Type 'Promise<number>' is not assignable to type 'Promise<string>'.
Type 'number' is not assignable to type 'string'.
tests/cases/compiler/promisePermutations3.ts(159,21): error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of type '{ <T>(x: T): IPromise<T>; <T>(x: T, y: T): Promise<T>; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<any>'.
Type 'IPromise<any>' is not assignable to type 'Promise<any>'.
==== tests/cases/compiler/promisePermutations3.ts (35 errors) ====
@ -113,6 +143,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
var r3b = r3.then(testFunction3, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3);
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
var s3: Promise<number>;
var s3a = s3.then(testFunction3, testFunction3, testFunction3);
var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P);
@ -120,6 +152,8 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
var s3d = s3.then(testFunction3P, testFunction3, testFunction3).then(testFunction3, testFunction3, testFunction3);
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number) => IPromise<number>' is not assignable to parameter of type '(value: IPromise<number>) => IPromise<number>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'IPromise<number>'.
var r4: IPromise<string>;
var sIPromise: (x: any) => IPromise<string>;
@ -127,17 +161,25 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
var r4a = r4.then(testFunction4, testFunction4, testFunction4); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok
var s4: Promise<string>;
var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number, y?: string) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'x' and 'value' are incompatible.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4);
var r5: IPromise<string>;
@ -178,17 +220,25 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
var r7a = r7.then(testFunction7, testFunction7, testFunction7); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok
var s7: Promise<string>;
var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error
~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => Promise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(cb: <T>(a: T) => T) => Promise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
!!! error TS2345: Types of parameters 'cb' and 'value' are incompatible.
!!! error TS2345: Type '<T>(a: T) => T' is not assignable to type 'string'.
var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok?
var r8: IPromise<number>;
@ -261,22 +311,31 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
~~~~~~~~
!!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'Promise<number>' is not a valid type argument because it is not a supertype of candidate 'IPromise<string>'.
!!! error TS2453: Types of property 'then' are incompatible.
!!! error TS2453: Type '<U>(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise<U>' is not assignable to type '{ <U>(success?: (value: number) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void): Promise<U>; <U>(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise<U>; }'.
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
var r11: IPromise<number>;
var r11a = r11.then(testFunction11, testFunction11, testFunction11); // ok
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11: Promise<number>;
var s11a = s11.then(testFunction11, testFunction11, testFunction11); // ok
~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): IPromise<number>; (x: string): IPromise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'IPromise<number>' is not assignable to type 'IPromise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11b = s11.then(testFunction11P, testFunction11P, testFunction11P); // error
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => Promise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'Promise<string>'.
!!! error TS2345: Type 'number' is not assignable to type 'string'.
var s11c = s11.then(testFunction11P, testFunction11, testFunction11); // error
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ (x: number): Promise<number>; (x: string): Promise<string>; }' is not assignable to parameter of type '(value: number) => IPromise<string>'.
!!! error TS2345: Type 'Promise<number>' is not assignable to type 'IPromise<string>'.
var r12 = testFunction12(x => x);
var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok
@ -285,4 +344,5 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ <T>(x: T): IPromise<T>; <T>(x: T, y: T): Promise<T>; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<any>'.
!!! error TS2345: Type 'IPromise<any>' is not assignable to type 'Promise<any>'.
var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok

View file

@ -2,6 +2,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(16,19): error TS2304: Cannot
tests/cases/compiler/recursiveClassReferenceTest.ts(56,11): error TS2304: Cannot find name 'domNode'.
tests/cases/compiler/recursiveClassReferenceTest.ts(88,36): error TS2304: Cannot find name 'mode'.
tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'.
Property 'getInitialState' is missing in type 'Window'.
==== tests/cases/compiler/recursiveClassReferenceTest.ts (4 errors) ====
@ -108,6 +109,7 @@ tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argume
return new State(self);
~~~~
!!! error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'.
!!! error TS2345: Property 'getInitialState' is missing in type 'Window'.
}

View file

@ -1,8 +1,10 @@
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts(2,15): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesA.ts (1 errors) ====
declare function foo3(cb: (x: number) => number): typeof cb;
var r5 = foo3((x: number) => ''); // error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
!!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => number'.
!!! error TS2345: Type 'string' is not assignable to type 'number'.

View file

@ -26,6 +26,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(64,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
Property 'z' is missing in type '{ x: number; y: string; }'.
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(77,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(81,25): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference.ts(86,23): error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
@ -164,6 +165,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
~~~~~~~~~~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'.
~~~
!!! error TS1159: Tagged templates are only available when targeting ECMAScript 6 and higher.
var a9e: {};

View file

@ -2,6 +2,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts(76,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
Property 'z' is missing in type '{ x: number; y: string; }'.
==== tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInferenceES6.ts (2 errors) ====
@ -87,6 +88,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsTypeArgumentInference
~~~~~~~~~~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'.
var a9e: {};
// Generic tag with multiple parameters of generic type passed arguments with a single best common type

View file

@ -1,5 +1,6 @@
tests/cases/compiler/typeArgInference2.ts(12,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'.
Property 'a' is missing in type '{ name: string; b: number; }'.
==== tests/cases/compiler/typeArgInference2.ts (1 errors) ====
@ -17,4 +18,5 @@ tests/cases/compiler/typeArgInference2.ts(12,10): error TS2453: The type argumen
var z6 = foo({ name: "abc", a: 5 }, { name: "def", b: 5 }); // error
~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'.
!!! error TS2453: Type argument candidate '{ name: string; a: number; }' is not a valid type argument because it is not a supertype of candidate '{ name: string; b: number; }'.
!!! error TS2453: Property 'a' is missing in type '{ name: string; b: number; }'.

View file

@ -1,4 +1,5 @@
tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'.
Property 'toDateString' is missing in type 'String'.
tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'.
@ -9,6 +10,7 @@ tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,12): error TS2345:
foo1<Date>(""); // should error
~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'Date'.
!!! error TS2345: Property 'toDateString' is missing in type 'String'.

View file

@ -2,6 +2,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(68,11
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
Property 'z' is missing in type '{ x: number; y: string; }'.
==== tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts (2 errors) ====
@ -93,6 +94,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInference.ts(82,11
~~~~~~~~~~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; z: Date; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'.
var a9e: {};
var a9f = someGenerics9<A92>(undefined, { x: 6, z: new Date() }, { x: 6, y: '' });
var a9f: A92;

View file

@ -1,13 +1,20 @@
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(25,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(51,19): error TS2304: Cannot find name 'Window'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(61,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(71,39): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(81,45): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
Types of parameters 'n' and 'b' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(106,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(118,9): error TS2304: Cannot find name 'Window'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,15): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
Property 'z' is missing in type '{ x: number; y: string; }'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(120,51): error TS2304: Cannot find name 'window'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstructSignatures.ts(122,56): error TS2304: Cannot find name 'window'.
@ -80,6 +87,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
new someGenerics4<string, number>('', (x: string) => ''); // Error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
new someGenerics4<string, number>(null, null);
// 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
@ -92,6 +101,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
new someGenerics5<number, string>('', (x: string) => ''); // Error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
new someGenerics5<string, number>(null, null);
// Generic call with multiple arguments of function types that each have parameters of the same generic type
@ -104,6 +115,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
new someGenerics6<number>((n: number) => n, (n: string) => n, (n: number) => n); // Error
~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
!!! error TS2345: Types of parameters 'n' and 'b' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
new someGenerics6<number>((n: number) => n, (n: number) => n, (n: number) => n);
// Generic call with multiple arguments of function types that each have parameters of different generic type
@ -151,6 +164,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct
~~~~~~~~~~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'.
~~~~~~
!!! error TS2304: Cannot find name 'window'.
var a9e: {};

View file

@ -1,7 +1,13 @@
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(3,31): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(7,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(11,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts(15,41): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
Types of parameters 'n' and 'b' are incompatible.
Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts (4 errors) ====
@ -16,16 +22,22 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts
someGenerics4<string, number>('', (x: string) => ''); // Error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
// 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
function someGenerics5<U, T>(n: T, f: (x: U) => void) { }
someGenerics5<number, string>('', (x: string) => ''); // Error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
// Generic call with multiple arguments of function types that each have parameters of the same generic type
function someGenerics6<A>(a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { }
someGenerics6<number>((n: number) => n, (n: string) => n, (n: number) => n); // Error
~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
!!! error TS2345: Types of parameters 'n' and 'b' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.

View file

@ -1,5 +1,6 @@
tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'.
Property 'y' is missing in type 'Elephant'.
==== tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts (1 errors) ====
@ -12,4 +13,5 @@ tests/cases/compiler/typeArgumentInferenceWithConstraintAsCommonRoot.ts(7,1): er
f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal
~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'.
!!! error TS2453: Type argument candidate 'Giraffe' is not a valid type argument because it is not a supertype of candidate 'Elephant'.
!!! error TS2453: Property 'y' is missing in type 'Elephant'.

View file

@ -4,15 +4,22 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(32,34): error TS2304: Cannot find name 'Window'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(34,15): error TS2304: Cannot find name 'Window'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(41,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(48,35): error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
Types of parameters 'x' and 'x' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(49,15): error TS2344: Type 'string' does not satisfy the constraint 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(55,41): error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
Types of parameters 'n' and 'b' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(66,31): error TS2345: Argument of type '<A, B extends string, C>(a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void' is not assignable to parameter of type 'string'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(73,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'number'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(85,9): error TS2304: Cannot find name 'Window'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
Property 'z' is missing in type '{ x: number; y: string; }'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(87,47): error TS2304: Cannot find name 'window'.
tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(89,52): error TS2304: Cannot find name 'window'.
@ -71,6 +78,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
someGenerics4<string, number>('', (x: string) => ''); // Error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
someGenerics4<string, number>(null, null);
// 2 parameter generic call with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type
@ -80,6 +89,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
someGenerics5<number, string>('', (x: string) => ''); // Error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(x: string) => string' is not assignable to parameter of type '(x: number) => void'.
!!! error TS2345: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
someGenerics5<string, number>(null, null); // Error
~~~~~~
!!! error TS2344: Type 'string' does not satisfy the constraint 'number'.
@ -91,6 +102,8 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
someGenerics6<number>((n: number) => n, (n: string) => n, (n: number) => n); // Error
~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(n: string) => string' is not assignable to parameter of type '(b: number) => number'.
!!! error TS2345: Types of parameters 'n' and 'b' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
someGenerics6<number>((n: number) => n, (n: number) => n, (n: number) => n);
// Generic call with multiple arguments of function types that each have parameters of different generic type
@ -133,6 +146,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst
~~~~~~~~~~~~~
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
!!! error TS2453: Type argument candidate '{ x: number; z: any; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y: string; }'.
!!! error TS2453: Property 'z' is missing in type '{ x: number; y: string; }'.
~~~~~~
!!! error TS2304: Cannot find name 'window'.
var a9e: {};

View file

@ -4,7 +4,9 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(31,12): err
tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(35,15): error TS2352: Neither type 'SomeOther' nor type 'SomeDerived' is assignable to the other.
Property 'x' is missing in type 'SomeOther'.
tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(37,13): error TS2352: Neither type 'SomeDerived' nor type 'SomeOther' is assignable to the other.
Property 'q' is missing in type 'SomeDerived'.
tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): error TS2352: Neither type 'SomeBase' nor type 'SomeOther' is assignable to the other.
Property 'q' is missing in type 'SomeBase'.
==== tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts (5 errors) ====
@ -55,9 +57,11 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): err
someOther = <SomeOther>someDerived; // Error
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Neither type 'SomeDerived' nor type 'SomeOther' is assignable to the other.
!!! error TS2352: Property 'q' is missing in type 'SomeDerived'.
someOther = <SomeOther>someBase; // Error
~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Neither type 'SomeBase' nor type 'SomeOther' is assignable to the other.
!!! error TS2352: Property 'q' is missing in type 'SomeBase'.
someOther = <SomeOther>someOther;

View file

@ -1,6 +1,7 @@
tests/cases/compiler/typeIdentityConsidersBrands.ts(30,1): error TS2322: Type 'X_1' is not assignable to type 'Y_1'.
Types have separate declarations of a private property 'name'.
tests/cases/compiler/typeIdentityConsidersBrands.ts(31,6): error TS2345: Argument of type 'Y_1' is not assignable to parameter of type 'X_1'.
Types have separate declarations of a private property 'name'.
==== tests/cases/compiler/typeIdentityConsidersBrands.ts (2 errors) ====
@ -40,4 +41,5 @@ tests/cases/compiler/typeIdentityConsidersBrands.ts(31,6): error TS2345: Argumen
foo2(a2); // should error
~~
!!! error TS2345: Argument of type 'Y_1' is not assignable to parameter of type 'X_1'.
!!! error TS2345: Types have separate declarations of a private property 'name'.

View file

@ -1,4 +1,5 @@
tests/cases/compiler/typeOfOnTypeArg.ts(7,6): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ '': number; }'.
Property '''' is missing in type 'Number'.
==== tests/cases/compiler/typeOfOnTypeArg.ts (1 errors) ====
@ -11,4 +12,5 @@ tests/cases/compiler/typeOfOnTypeArg.ts(7,6): error TS2345: Argument of type 'nu
fill(32);
~~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type '{ '': number; }'.
!!! error TS2345: Property '''' is missing in type 'Number'.

View file

@ -1,5 +1,6 @@
tests/cases/compiler/undeclaredModuleError.ts(1,21): error TS2307: Cannot find external module 'fs'.
tests/cases/compiler/undeclaredModuleError.ts(8,29): error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: any, name: string) => boolean'.
Type 'void' is not assignable to type 'boolean'.
tests/cases/compiler/undeclaredModuleError.ts(11,41): error TS2304: Cannot find name 'IDoNotExist'.
@ -18,6 +19,7 @@ tests/cases/compiler/undeclaredModuleError.ts(11,41): error TS2304: Cannot find
} , (error: Error, files: {}[]) => {
~~~~~~~~~
!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: any, name: string) => boolean'.
!!! error TS2345: Type 'void' is not assignable to type 'boolean'.
files.forEach((file) => {
var fullPath = join(IDoNotExist);
~~~~~~~~~~~

View file

@ -0,0 +1,25 @@
interface FileSystem {
read: number;
}
function fn(s: WorkerFS): void;
function fn(s: FileSystem): void;
function fn(s: FileSystem|WorkerFS) { }
// This should issue a large error, not a small one
class WorkerFS implements FileSystem {
read: string;
}
interface Alpha { x: string; }
interface Beta { y: number; }
var x: Alpha;
var y: Beta;
// Only one of these errors should be large
x = y;
x = y;
// Only one of these errors should be large
y = x;
y = x;