From 02cb9ad9c29293629528c4f77a202b8ddcb58a70 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 25 Feb 2016 17:04:38 -0800 Subject: [PATCH 01/11] Update version --- package.json | 2 +- src/compiler/program.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0167ff494ef..3fc0bd67db8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.8.2", + "version": "1.8.5", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/program.ts b/src/compiler/program.ts index f74f21fcf2f..a76517ecbce 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -12,7 +12,7 @@ namespace ts { const emptyArray: any[] = []; - export const version = "1.8.2"; + export const version = "1.8.5"; export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string { let fileName = "tsconfig.json"; From dc4cd52a9a09bd4eee1fbebde98b41f2c503b335 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 25 Feb 2016 17:12:03 -0800 Subject: [PATCH 02/11] Update LKG --- lib/tsc.js | 3 ++- lib/tsserver.js | 3 ++- lib/typescript.js | 3 ++- lib/typescriptServices.js | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index f9cbdae0d69..8e330ebb650 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -19667,6 +19667,7 @@ var ts; checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -32465,7 +32466,7 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.8.2"; + ts.version = "1.8.5"; function findConfigFile(searchPath, fileExists) { var fileName = "tsconfig.json"; while (true) { diff --git a/lib/tsserver.js b/lib/tsserver.js index 47436063545..32bf7274dc3 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -20235,6 +20235,7 @@ var ts; checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -33033,7 +33034,7 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; - ts.version = "1.8.2"; + ts.version = "1.8.5"; function findConfigFile(searchPath, fileExists) { var fileName = "tsconfig.json"; while (true) { diff --git a/lib/typescript.js b/lib/typescript.js index bb880f52c1a..5923ee0e111 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -24302,6 +24302,7 @@ var ts; } // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -39260,7 +39261,7 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.8.2"; + ts.version = "1.8.5"; function findConfigFile(searchPath, fileExists) { var fileName = "tsconfig.json"; while (true) { diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index bb880f52c1a..5923ee0e111 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -24302,6 +24302,7 @@ var ts; } // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -39260,7 +39261,7 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; - ts.version = "1.8.2"; + ts.version = "1.8.5"; function findConfigFile(searchPath, fileExists) { var fileName = "tsconfig.json"; while (true) { From 904091e6ea7be2931bd2a82ea083742894b39ac4 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 26 Feb 2016 14:41:49 -0800 Subject: [PATCH 03/11] Fix duplicate errors in JSDoc function types with anon parameters Fixes #6993 --- src/compiler/binder.ts | 1 + tests/cases/fourslash/jsDocFunctionSignatures4.ts | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/cases/fourslash/jsDocFunctionSignatures4.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 933381afa92..caddd68dd21 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -749,6 +749,7 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.FunctionType: + case SyntaxKind.JSDocFunctionType: case SyntaxKind.ConstructorType: case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: diff --git a/tests/cases/fourslash/jsDocFunctionSignatures4.ts b/tests/cases/fourslash/jsDocFunctionSignatures4.ts new file mode 100644 index 00000000000..e2b443d8d40 --- /dev/null +++ b/tests/cases/fourslash/jsDocFunctionSignatures4.ts @@ -0,0 +1,11 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js + +//// /** @param {function ({OwnerID:string,AwayID:string}):void} x +//// * @param {function (string):void} y */ +//// function fn(x, y) { } + +verify.numberOfErrorsInCurrentFile(0); + From 8334aeac4dba023c19a77cfb31f5318d46af91be Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 26 Feb 2016 14:58:01 -0800 Subject: [PATCH 04/11] Don't error on duplicate prototype property assignments Fixes #7063 --- src/compiler/binder.ts | 2 +- tests/cases/fourslash/jsDocClasses1.ts | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/jsDocClasses1.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 933381afa92..43feb6008cf 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1465,7 +1465,7 @@ namespace ts { } // Declare the method/property - declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes); + declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property); } function bindCallExpression(node: CallExpression) { diff --git a/tests/cases/fourslash/jsDocClasses1.ts b/tests/cases/fourslash/jsDocClasses1.ts new file mode 100644 index 00000000000..c68afa0e14b --- /dev/null +++ b/tests/cases/fourslash/jsDocClasses1.ts @@ -0,0 +1,28 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js + +//// function fn() { +//// this.foo = 10; +//// } +//// fn.prototype.foo = 14; +//// var x = new fn(); +//// +//// function fn2() { +//// this.foo = 10; +//// this.foo = 10; +//// } +//// fn2.prototype.foo = 14; +//// fn2.prototype.foo = 14; +//// var y = new fn2(); +//// +//// function fn3() { +//// this.foo = 10; +//// } +//// fn3.prototype.foo = 14; +//// fn3.prototype.foo = 14; +//// var z = new fn3(); + +verify.numberOfErrorsInCurrentFile(0); + From 6253c9b5cd6a8fa5e08bf88ddabdf0283ccf7007 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Mon, 29 Feb 2016 19:21:20 -0800 Subject: [PATCH 05/11] Add JavaScriptFile to ContextFlags --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8fd21ed008a..d605a684a76 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -430,7 +430,7 @@ namespace ts { JavaScriptFile = 1 << 5, // Context flags set directly by the parser. - ParserGeneratedFlags = DisallowIn | Yield | Decorator | ThisNodeHasError | Await, + ParserGeneratedFlags = DisallowIn | Yield | Decorator | ThisNodeHasError | Await | JavaScriptFile, // Exclude these flags when parsing a Type TypeExcludesFlags = Yield | Await, From ae27b8984730879de63749023cc68d0e777f0fe6 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Mon, 29 Feb 2016 22:37:42 -0800 Subject: [PATCH 06/11] Fix failing JSDocParser tests --- tests/cases/unittests/jsDocParsing.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/cases/unittests/jsDocParsing.ts b/tests/cases/unittests/jsDocParsing.ts index 9988383b467..e2941f7fc19 100644 --- a/tests/cases/unittests/jsDocParsing.ts +++ b/tests/cases/unittests/jsDocParsing.ts @@ -11,6 +11,9 @@ module ts { assert.isTrue(typeAndDiagnostics && typeAndDiagnostics.diagnostics.length === 0); let result = Utils.sourceFileToJSON(typeAndDiagnostics.jsDocTypeExpression.type); + + // Remove the parserContextFlags from the comparison + result = result.replace(/\,\n\s+\"parserContextFlags\": \"JavaScriptFile\"/g, ""); assert.equal(result, expected); } @@ -998,7 +1001,10 @@ module ts { ? JSON.parse(Utils.sourceFileToJSON(v)) : v; }, 4); - + + // Remove the parserContextFlags from the comparison + result = result.replace(/\,\n\s+\"parserContextFlags\": \"JavaScriptFile\"/g, ""); + if (result !== expected) { // Turn on a human-readable diff if (typeof require !== 'undefined') { From b5da80202f41e6f293153a2df945063d584b022a Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Tue, 1 Mar 2016 10:36:37 -0800 Subject: [PATCH 07/11] Changed how parserContextFlags are handled in tests --- src/harness/harness.ts | 4 ++++ tests/cases/unittests/jsDocParsing.ts | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 5c191a3b9d7..858607143d2 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -285,6 +285,10 @@ namespace Utils { // data we don't care about in the dump. We only care what the parser set directly // on the ast. let value = n.parserContextFlags & ts.ParserContextFlags.ParserGeneratedFlags; + + // Remove the JavaScriptFile flag, as this is just noise for JSDocParser and Test262 tests + // (which are the only tests that use this function). + value = value & ~ts.ParserContextFlags.JavaScriptFile; if (value) { o[propertyName] = getParserContextFlagName(value); } diff --git a/tests/cases/unittests/jsDocParsing.ts b/tests/cases/unittests/jsDocParsing.ts index e2941f7fc19..9c68cea3297 100644 --- a/tests/cases/unittests/jsDocParsing.ts +++ b/tests/cases/unittests/jsDocParsing.ts @@ -12,8 +12,6 @@ module ts { let result = Utils.sourceFileToJSON(typeAndDiagnostics.jsDocTypeExpression.type); - // Remove the parserContextFlags from the comparison - result = result.replace(/\,\n\s+\"parserContextFlags\": \"JavaScriptFile\"/g, ""); assert.equal(result, expected); } @@ -1002,9 +1000,6 @@ module ts { : v; }, 4); - // Remove the parserContextFlags from the comparison - result = result.replace(/\,\n\s+\"parserContextFlags\": \"JavaScriptFile\"/g, ""); - if (result !== expected) { // Turn on a human-readable diff if (typeof require !== 'undefined') { From 766439ed011a4ae584679146b3058a1d1f06bbea Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 1 Mar 2016 12:40:47 -0800 Subject: [PATCH 08/11] Update comment --- src/compiler/binder.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 43feb6008cf..391c656c814 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1465,6 +1465,7 @@ namespace ts { } // Declare the method/property + // It's acceptable for multiple prototype property assignments of the same identifier to occur declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property); } From 90526036c309232cd0b53d6a3f3f7f9e5ef34633 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 1 Mar 2016 19:28:19 -0800 Subject: [PATCH 09/11] port pull request #7328 from Microsoft/flipSidesInSignatureCheck --- src/compiler/checker.ts | 2 +- .../reference/arrayLiterals3.errors.txt | 8 ++-- .../reference/assignmentCompatBug5.errors.txt | 4 +- ...ignmentCompatWithCallSignatures.errors.txt | 32 ++++++------- ...gnmentCompatWithCallSignatures2.errors.txt | 16 +++---- ...gnmentCompatWithCallSignatures4.errors.txt | 8 ++-- ...allSignaturesWithRestParameters.errors.txt | 36 +++++++------- ...tCompatWithConstructSignatures4.errors.txt | 40 ++++++++-------- .../assignmentCompatWithOverloads.errors.txt | 8 ++-- ...tureAssignabilityInInheritance3.errors.txt | 8 ++-- ...tureAssignabilityInInheritance3.errors.txt | 8 ++-- .../reference/contextualTyping24.errors.txt | 4 +- ...lTypingOfConditionalExpression2.errors.txt | 4 +- .../derivedClassTransitivity.errors.txt | 4 +- .../derivedClassTransitivity2.errors.txt | 4 +- .../derivedClassTransitivity3.errors.txt | 4 +- .../derivedClassTransitivity4.errors.txt | 4 +- ...tructuringParameterDeclaration2.errors.txt | 8 ++-- ...AnnotationAndInvalidInitializer.errors.txt | 8 ++-- ...functionConstraintSatisfaction2.errors.txt | 4 +- ...ctionSignatureAssignmentCompat1.errors.txt | 4 +- ...AssignmentCompatWithInterfaces1.errors.txt | 4 +- ...lWithGenericSignatureArguments2.errors.txt | 14 ++---- .../genericSpecializations3.errors.txt | 12 ++--- .../genericTypeAssertions2.errors.txt | 4 +- ...cTypeWithNonGenericBaseMisMatch.errors.txt | 18 +++---- ...ementGenericWithMismatchedTypes.errors.txt | 4 +- .../reference/incompatibleTypes.errors.txt | 4 +- .../interfaceAssignmentCompat.errors.txt | 10 ++-- .../lastPropertyInLiteralWins.errors.txt | 4 +- ...ptionalFunctionArgAssignability.errors.txt | 4 +- .../optionalParamAssignmentCompat.errors.txt | 4 +- .../optionalParamTypeComparison.errors.txt | 8 ++-- ...nWithConstraintCheckingDeferred.errors.txt | 8 ++-- .../reference/promisePermutations.errors.txt | 44 ++++++++--------- .../reference/promisePermutations2.errors.txt | 44 ++++++++--------- .../reference/promisePermutations3.errors.txt | 48 +++++++++---------- .../restArgAssignmentCompat.errors.txt | 4 +- ...allSignaturesWithRestParameters.errors.txt | 44 ++++++++--------- ...entInferenceConstructSignatures.errors.txt | 12 ++--- .../typeArgumentInferenceErrors.errors.txt | 12 ++--- ...rgumentInferenceWithConstraints.errors.txt | 12 ++--- ...ypeParameterArgumentEquivalence.errors.txt | 8 ++-- ...peParameterArgumentEquivalence2.errors.txt | 8 ++-- 44 files changed, 269 insertions(+), 283 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 603f5dae821..e6d3ec5ccea 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5242,7 +5242,7 @@ namespace ts { for (let i = 0; i < checkCount; i++) { const s = i < sourceMax ? getTypeOfSymbol(sourceParams[i]) : getRestTypeOfSignature(source); const t = i < targetMax ? getTypeOfSymbol(targetParams[i]) : getRestTypeOfSignature(target); - const related = compareTypes(t, s, /*reportErrors*/ false) || compareTypes(s, t, reportErrors); + const related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); if (!related) { if (reportErrors) { errorReporter(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, diff --git a/tests/baselines/reference/arrayLiterals3.errors.txt b/tests/baselines/reference/arrayLiterals3.errors.txt index 5409075a55c..f205e90eced 100644 --- a/tests/baselines/reference/arrayLiterals3.errors.txt +++ b/tests/baselines/reference/arrayLiterals3.errors.txt @@ -16,8 +16,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error Types of property 'push' are incompatible. Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. Types of parameters 'items' and 'items' are incompatible. - Type 'number | string' is not assignable to type 'Number'. - Type 'string' is not assignable to type 'Number'. + Type 'Number' is not assignable to type 'number | string'. + Type 'Number' is not assignable to type 'string'. ==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ==== @@ -79,6 +79,6 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error !!! error TS2322: Types of property 'push' are incompatible. !!! error TS2322: Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'. !!! error TS2322: Types of parameters 'items' and 'items' are incompatible. -!!! error TS2322: Type 'number | string' is not assignable to type 'Number'. -!!! error TS2322: Type 'string' is not assignable to type 'Number'. +!!! error TS2322: Type 'Number' is not assignable to type 'number | string'. +!!! error TS2322: Type 'Number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatBug5.errors.txt b/tests/baselines/reference/assignmentCompatBug5.errors.txt index 1b5e3d80259..44e28f15d8c 100644 --- a/tests/baselines/reference/assignmentCompatBug5.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug5.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of typ 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'. + Type 'number' is not assignable to type 'string'. 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'. @@ -27,7 +27,7 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ ~~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. foo3((n) => { return; }); ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt index 6a221ef144e..c5914e59386 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.errors.txt @@ -1,27 +1,27 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(35,1): error TS2322: Type 'S2' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(36,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(37,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(38,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(39,1): error TS2322: Type 'S2' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(40,1): error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(41,1): error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts(42,1): error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures.ts (8 errors) ==== @@ -63,40 +63,40 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type 'S2' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = s2; ~ !!! error TS2322: Type 'S2' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = a3; ~ !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = function (x: string) { return ''; } ~ !!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt index e67f0a930c2..ffc0fdcd772 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.errors.txt @@ -10,12 +10,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(43,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(44,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(45,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'. @@ -24,12 +24,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(47,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f(x: number): void; }'. Types of property 'f' are incompatible. Type '(x: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(48,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }'. Property 'f' is missing in type '(x: string) => number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts(49,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f(x: number): void; }'. @@ -96,14 +96,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. t = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'. @@ -118,14 +118,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = a3; ~ !!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f(x: number): void; }'. !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = (x: string) => 1; ~ !!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f(x: number): void; }'. diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt index a75b5fafac1..8d184edc085 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(52,9): error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(53,9): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. Types of parameters 'arg2' and 'arg2' are incompatible. Type 'Base' is not assignable to type '{ foo: number; }'. Types of property 'foo' are incompatible. @@ -70,7 +70,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2322: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2322: Types of property 'foo' are incompatible. @@ -79,7 +79,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. +!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. !!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'. !!! error TS2322: Types of property 'foo' are incompatible. diff --git a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt index 8eec8503e70..6b563ef2631 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignaturesWithRestParameters.errors.txt @@ -1,30 +1,30 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(13,5): error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'args' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(17,5): error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'x' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(26,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(35,5): error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(36,5): error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'z' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(37,5): error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(41,5): error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(43,5): error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts(45,5): error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignaturesWithRestParameters.ts (9 errors) ==== @@ -44,7 +44,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2322: Types of parameters 'args' and 'args' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a = (x?: number) => 1; // ok, same number of required params a = (x?: number, y?: number, z?: number) => 1; // ok, same number of required params a = (x: number) => 1; // ok, rest param corresponds to infinite number of params @@ -52,7 +52,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~ !!! error TS2322: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2322: Types of parameters 'x' and 'args' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var a2: (x: number, ...z: number[]) => number; @@ -65,7 +65,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. a2 = (x: number, y: number) => 1; // ok, rest param corresponds to infinite number of params a2 = (x: number, y?: number) => 1; // ok, same number of required params @@ -78,17 +78,17 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a3 = (x: number, ...z: number[]) => 1; // error ~~ !!! error TS2322: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'z' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a3 = (x: string, y?: string, z?: string) => 1; // error ~~ !!! error TS2322: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var a4: (x?: number, y?: string, ...z: number[]) => number; a4 = () => 1; // ok, fewer required params @@ -96,16 +96,16 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a4 = (x: number) => 1; // ok, all present params match a4 = (x: number, y?: number) => 1; // error, second param has type mismatch ~~ !!! error TS2322: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. a4 = (x?: number, y?: string) => 1; // ok, same number of required params with matching types a4 = (x: number, ...args: string[]) => 1; // error, rest params have type mismatch ~~ !!! error TS2322: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2322: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt index da9ffba1ee1..3f8111a3244 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.errors.txt @@ -1,33 +1,33 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(52,9): error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(53,9): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. + Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. Types of parameters 'arg2' and 'arg2' are incompatible. Type 'Base' is not assignable to type '{ foo: number; }'. Types of property 'foo' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. - Types of parameters 'x' and 'x' are incompatible. - Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. - Type '(a: any) => any' provides no match for the signature 'new (a: number): number' -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. Types of parameters 'x' and 'x' are incompatible. Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any' -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. Types of parameters 'x' and 'x' are incompatible. - Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. - Type '(a: any) => any' provides no match for the signature 'new (a: T): T' -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. + Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. + Type '(a: any) => any' provides no match for the signature 'new (a: number): number' +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. Types of parameters 'x' and 'x' are incompatible. Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any' +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. + Types of parameters 'x' and 'x' are incompatible. + Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. + Type '(a: any) => any' provides no match for the signature 'new (a: T): T' ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (6 errors) ==== @@ -86,7 +86,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2322: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2322: Types of property 'foo' are incompatible. @@ -95,7 +95,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~ !!! error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. +!!! error TS2322: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. !!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'. !!! error TS2322: Types of property 'foo' are incompatible. @@ -127,28 +127,28 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme ~~~ !!! error TS2322: Type 'new (x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. -!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number' +!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any' b16 = a16; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new (x: (a: T) => T) => T[]'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'. -!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any' +!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'. +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number' var b17: new (x: (a: T) => T) => any[]; a17 = b17; // error ~~~ !!! error TS2322: Type 'new (x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. -!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: T): T' +!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. +!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any' b17 = a17; // error ~~~ !!! error TS2322: Type '{ new (x: { new (a: T): T; new (a: T): T; }): any[]; new (x: { new (a: T): T; new (a: T): T; }): any[]; }' is not assignable to type 'new (x: (a: T) => T) => any[]'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' is not assignable to type '(a: any) => any'. -!!! error TS2322: Type '{ new (a: T): T; new (a: T): T; }' provides no match for the signature '(a: any): any' +!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: T): T; new (a: T): T; }'. +!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: T): T' } module WithGenericSignaturesInBaseType { diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt b/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt index 3bea0c46716..3773229f516 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithOverloads.errors.txt @@ -2,12 +2,12 @@ tests/cases/compiler/assignmentCompatWithOverloads.ts(17,1): error TS2322: Type Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatWithOverloads.ts(19,1): error TS2322: Type '(x: number) => number' is not assignable to type '(s1: string) => number'. Types of parameters 'x' and 's1' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatWithOverloads.ts(21,1): error TS2322: Type '{ (x: string): string; (x: number): number; }' is not assignable to type '(s1: string) => number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatWithOverloads.ts(30,1): error TS2322: Type 'typeof C' is not assignable to type 'new (x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/assignmentCompatWithOverloads.ts (4 errors) ==== @@ -36,7 +36,7 @@ tests/cases/compiler/assignmentCompatWithOverloads.ts(30,1): error TS2322: Type ~ !!! error TS2322: Type '(x: number) => number' is not assignable to type '(s1: string) => number'. !!! error TS2322: Types of parameters 'x' and 's1' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. g = f4; // Error ~ @@ -54,4 +54,4 @@ tests/cases/compiler/assignmentCompatWithOverloads.ts(30,1): error TS2322: Type ~ !!! error TS2322: Type 'typeof C' is not assignable to type 'new (x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt index 7e9d75b1b41..2d7e795d26a 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.errors.txt @@ -2,12 +2,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign Types of property 'a2' are incompatible. Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. - Type 'T' is not assignable to type 'number'. + Type 'number' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSignatureAssignabilityInInheritance3.ts(60,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. @@ -71,7 +71,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: T) => U[]' is not assignable to type '(x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2430: Type 'T' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'T'. a2: (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -86,7 +86,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/callSign !!! error TS2430: Types of property 'a8' are incompatible. !!! error TS2430: Type '(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2430: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2430: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2430: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2430: Types of property 'foo' are incompatible. diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt index 8d6273804f7..086372aac17 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.errors.txt @@ -2,12 +2,12 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc Types of property 'a2' are incompatible. Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. Types of parameters 'x' and 'x' are incompatible. - Type 'T' is not assignable to type 'number'. + Type 'number' is not assignable to type 'T'. tests/cases/conformance/types/typeRelationships/assignmentCompatibility/constructSignatureAssignabilityInInheritance3.ts(50,19): error TS2430: Interface 'I4' incorrectly extends interface 'A'. Types of property 'a8' are incompatible. Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. Types of parameters 'y' and 'y' are incompatible. - Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. + Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. Types of parameters 'arg2' and 'arg2' are incompatible. Type '{ foo: number; }' is not assignable to type 'Base'. Types of property 'foo' are incompatible. @@ -61,7 +61,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type 'new (x: T) => U[]' is not assignable to type 'new (x: number) => string[]'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2430: Type 'T' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'T'. a2: new (x: T) => U[]; // error, no contextual signature instantiation since I2.a2 is not generic } @@ -76,7 +76,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/construc !!! error TS2430: Types of property 'a8' are incompatible. !!! error TS2430: Type 'new (x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U' is not assignable to type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type '(arg2: { foo: number; }) => any' is not assignable to type '(arg2: Base) => Derived'. +!!! error TS2430: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'. !!! error TS2430: Types of parameters 'arg2' and 'arg2' are incompatible. !!! error TS2430: Type '{ foo: number; }' is not assignable to type 'Base'. !!! error TS2430: Types of property 'foo' are incompatible. diff --git a/tests/baselines/reference/contextualTyping24.errors.txt b/tests/baselines/reference/contextualTyping24.errors.txt index a172600e1c5..f4205f24359 100644 --- a/tests/baselines/reference/contextualTyping24.errors.txt +++ b/tests/baselines/reference/contextualTyping24.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. Types of parameters 'a' and 'a' are incompatible. - Type 'string' is not assignable to type '{ (): number; (i: number): number; }'. + Type '{ (): number; (i: number): number; }' is not assignable to type 'string'. ==== tests/cases/compiler/contextualTyping24.ts (1 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(a: string ~~~ !!! error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. !!! error TS2322: Types of parameters 'a' and 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type '{ (): number; (i: number): number; }'. \ No newline at end of file +!!! error TS2322: Type '{ (): number; (i: number): number; }' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt b/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt index be49b7b5249..4f2adf9921e 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS2322: Type '((a: C) => number) | ((b: number) => void)' is not assignable to type '(a: A) => void'. Type '(b: number) => void' is not assignable to type '(a: A) => void'. Types of parameters 'b' and 'a' are incompatible. - Type 'number' is not assignable to type 'A'. + Type 'A' is not assignable to type 'number'. ==== tests/cases/compiler/contextualTypingOfConditionalExpression2.ts (1 errors) ==== @@ -20,5 +20,5 @@ tests/cases/compiler/contextualTypingOfConditionalExpression2.ts(11,5): error TS !!! error TS2322: Type '((a: C) => number) | ((b: number) => void)' is not assignable to type '(a: A) => void'. !!! error TS2322: Type '(b: number) => void' is not assignable to type '(a: A) => void'. !!! error TS2322: Types of parameters 'b' and 'a' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'A'. +!!! error TS2322: Type 'A' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity.errors.txt b/tests/baselines/reference/derivedClassTransitivity.errors.txt index c6b620beb18..5be930fa5da 100644 --- a/tests/baselines/reference/derivedClassTransitivity.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x?: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity.ts (1 errors) ==== @@ -29,6 +29,6 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x?: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r = c.foo(1); var r2 = e.foo(''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity2.errors.txt b/tests/baselines/reference/derivedClassTransitivity2.errors.txt index a8d2003c876..e5f09911f55 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity2.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x: number, y?: string) => void' is not assignable to type '(x: number, y: number) => void'. Types of parameters 'y' and 'y' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity2.ts (1 errors) ==== @@ -29,6 +29,6 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: number, y?: string) => void' is not assignable to type '(x: number, y: number) => void'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r = c.foo(1, 1); var r2 = e.foo(1, ''); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity3.errors.txt b/tests/baselines/reference/derivedClassTransitivity3.errors.txt index 9d301255dfd..b3e59a0bf4c 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x: string, y?: number) => void' is not assignable to type '(x: string, y: string) => void'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity3.ts (1 errors) ==== @@ -29,6 +29,6 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: string, y?: number) => void' is not assignable to type '(x: string, y: string) => void'. !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var r = c.foo('', ''); var r2 = e.foo('', 1); \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassTransitivity4.errors.txt b/tests/baselines/reference/derivedClassTransitivity4.errors.txt index c1a80e0a1d7..332232a7765 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.errors.txt +++ b/tests/baselines/reference/derivedClassTransitivity4.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra Types of property 'foo' are incompatible. Type '(x?: string) => void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTransitivity4.ts(19,9): error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. @@ -30,7 +30,7 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassTra !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x?: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r = c.foo(1); ~~~~~ !!! error TS2445: Property 'foo' is protected and only accessible within class 'C' and its subclasses. diff --git a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt index 8c0781571e4..114efc14d9c 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration2.errors.txt @@ -46,8 +46,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( Types of property 'd4' are incompatible. Type '({x, y, c}: { x: any; y: any; c: any; }) => void' is not assignable to type '({x, y, z}?: { x: any; y: any; z: any; }) => any'. Types of parameters '__0' and '__0' are incompatible. - Type '{ x: any; y: any; c: any; }' is not assignable to type '{ x: any; y: any; z: any; }'. - Property 'z' is missing in type '{ x: any; y: any; c: any; }'. + Type '{ x: any; y: any; z: any; }' is not assignable to type '{ x: any; y: any; c: any; }'. + Property 'c' is missing in type '{ x: any; y: any; z: any; }'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(56,8): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,18): error TS2300: Duplicate identifier 'number'. tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(65,26): error TS2300: Duplicate identifier 'number'. @@ -176,8 +176,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts( !!! error TS2420: Types of property 'd4' are incompatible. !!! error TS2420: Type '({x, y, c}: { x: any; y: any; c: any; }) => void' is not assignable to type '({x, y, z}?: { x: any; y: any; z: any; }) => any'. !!! error TS2420: Types of parameters '__0' and '__0' are incompatible. -!!! error TS2420: Type '{ x: any; y: any; c: any; }' is not assignable to type '{ x: any; y: any; z: any; }'. -!!! error TS2420: Property 'z' is missing in type '{ x: any; y: any; c: any; }'. +!!! error TS2420: Type '{ x: any; y: any; z: any; }' is not assignable to type '{ x: any; y: any; c: any; }'. +!!! error TS2420: Property 'c' is missing in type '{ x: any; y: any; z: any; }'. d3([a, b, c]?) { } // Error, binding pattern can't be optional in implementation signature ~~~~~~~~~~ !!! error TS2463: A binding pattern parameter cannot be optional in an implementation signature. diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index fc1bcaa545a..13c2058b657 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -16,10 +16,10 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd Type 'number' is not assignable to type 'string'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(46,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(47,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,5): error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'. Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'. @@ -107,12 +107,12 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd ~~~~~~~~~ !!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var anOtherFunction: (x: string) => number = F2; ~~~~~~~~~~~~~~~ !!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var aLambda: typeof F = (x) => 'a string'; ~~~~~~~ !!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'. diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index d2299894c59..7d3fa793ec8 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain Type 'Function' provides no match for the signature '(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'. + 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'. Type 'typeof C' provides no match for the signature '(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'. @@ -63,7 +63,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain ~~~~~~~~~~~~~~~~~~ !!! 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'. +!!! 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'. diff --git a/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt b/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt index 86c4728dda2..f91a4f91547 100644 --- a/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/functionSignatureAssignmentCompat1.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/functionSignatureAssignmentCompat1.ts(10,5): error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc'. Types of parameters 'delimiter' and 'eventEmitter' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/functionSignatureAssignmentCompat1.ts (1 errors) ==== @@ -17,5 +17,5 @@ tests/cases/compiler/functionSignatureAssignmentCompat1.ts(10,5): error TS2322: ~ !!! error TS2322: Type '(delimiter?: string) => ParserFunc' is not assignable to type 'ParserFunc'. !!! error TS2322: Types of parameters 'delimiter' and 'eventEmitter' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var e: ParserFunc = parsers.readline(); // ok \ No newline at end of file diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt index f335319cafd..63679ff03b7 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(12,5): error TS23 Types of property 'compareTo' are incompatible. Type '(other: number) => number' is not assignable to type '(other: string) => number'. Types of parameters 'other' and 'other' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(13,5): error TS2322: Type '{ x: A; }' is not assignable to type 'I'. Types of property 'x' are incompatible. Type 'A' is not assignable to type 'Comparable'. @@ -36,7 +36,7 @@ tests/cases/compiler/genericAssignmentCompatWithInterfaces1.ts(17,5): error TS23 !!! error TS2322: Types of property 'compareTo' are incompatible. !!! error TS2322: Type '(other: number) => number' is not assignable to type '(other: string) => number'. !!! error TS2322: Types of parameters 'other' and 'other' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var a2: I = function (): { x: A } { ~~ !!! error TS2322: Type '{ x: A; }' is not assignable to type 'I'. diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index c264058ad9f..e3da7eaeaec 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -4,17 +4,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen 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'. - Type 'RegExp' is not assignable to type 'Date'. - Property 'toDateString' is missing in type 'RegExp'. + Type 'Date' is not assignable to type 'T'. 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'. - Type 'RegExp' is not assignable to type 'Date'. + Type 'Date' is not assignable to type 'T'. 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'. @@ -55,9 +52,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen ~~~~~~~~~~~ !!! 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'. -!!! error TS2345: Type 'RegExp' is not assignable to type 'Date'. -!!! error TS2345: Property 'toDateString' is missing in type 'RegExp'. +!!! error TS2345: Type 'Date' is not assignable to type 'T'. var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date } @@ -103,8 +98,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen ~~~~~~~~~~~ !!! 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'. -!!! error TS2345: Type 'RegExp' is not assignable to type 'Date'. +!!! error TS2345: Type 'Date' is not assignable to type 'T'. var r7b = foo2((a) => a, (b) => b); } diff --git a/tests/baselines/reference/genericSpecializations3.errors.txt b/tests/baselines/reference/genericSpecializations3.errors.txt index ccaa839f9d0..87a7d5bcce7 100644 --- a/tests/baselines/reference/genericSpecializations3.errors.txt +++ b/tests/baselines/reference/genericSpecializations3.errors.txt @@ -2,17 +2,17 @@ tests/cases/compiler/genericSpecializations3.ts(8,7): error TS2420: Class 'IntFo Types of property 'foo' are incompatible. Type '(x: string) => string' is not assignable to type '(x: number) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/genericSpecializations3.ts(28,1): error TS2322: Type 'StringFoo2' is not assignable to type 'IntFoo'. Types of property 'foo' are incompatible. Type '(x: string) => string' is not assignable to type '(x: number) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/genericSpecializations3.ts(29,1): error TS2322: Type 'IntFoo' is not assignable to type 'StringFoo2'. Types of property 'foo' are incompatible. Type '(x: number) => number' is not assignable to type '(x: string) => string'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/compiler/genericSpecializations3.ts (3 errors) ==== @@ -29,7 +29,7 @@ tests/cases/compiler/genericSpecializations3.ts(29,1): error TS2322: Type 'IntFo !!! error TS2420: Types of property 'foo' are incompatible. !!! error TS2420: Type '(x: string) => string' is not assignable to type '(x: number) => number'. !!! error TS2420: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2420: Type 'string' is not assignable to type 'number'. +!!! error TS2420: Type 'number' is not assignable to type 'string'. foo(x: string): string { return null; } } @@ -55,14 +55,14 @@ tests/cases/compiler/genericSpecializations3.ts(29,1): error TS2322: Type 'IntFo !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: number) => number'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. stringFoo2 = intFoo; // error ~~~~~~~~~~ !!! error TS2322: Type 'IntFoo' is not assignable to type 'StringFoo2'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: number) => number' is not assignable to type '(x: string) => string'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. class StringFoo3 implements IFoo { // error diff --git a/tests/baselines/reference/genericTypeAssertions2.errors.txt b/tests/baselines/reference/genericTypeAssertions2.errors.txt index eda4c83646c..e424e6a13b1 100644 --- a/tests/baselines/reference/genericTypeAssertions2.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions2.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/genericTypeAssertions2.ts(10,5): error TS2322: Type 'B void' is not assignable to type '(x: number) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/compiler/genericTypeAssertions2.ts(11,5): error TS2322: Type 'A' is not assignable to type 'B'. Property 'bar' is missing in type 'A'. tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Neither type 'undefined[]' nor type 'A' is assignable to the other. @@ -25,7 +25,7 @@ tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Neither typ !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '(x: string) => void' is not assignable to type '(x: number) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var r3: B = >new B(); // error ~~ !!! error TS2322: Type 'A' is not assignable to type 'B'. diff --git a/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt b/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt index 0fe15afcf33..3ec6fa5e9f6 100644 --- a/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt +++ b/tests/baselines/reference/genericTypeWithNonGenericBaseMisMatch.errors.txt @@ -2,17 +2,14 @@ tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(4,7): error TS2420 Types of property 'f' are incompatible. Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void'. Types of parameters 'a' and 'a' are incompatible. - Type 'T' is not assignable to type '{ a: number; }'. - Type '{ a: string; }' is not assignable to type '{ a: number; }'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number'. + Type '{ a: number; }' is not assignable to type 'T'. tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2322: Type 'X<{ a: string; }>' is not assignable to type 'I'. Types of property 'f' are incompatible. Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void'. Types of parameters 'a' and 'a' are incompatible. - Type '{ a: string; }' is not assignable to type '{ a: number; }'. + Type '{ a: number; }' is not assignable to type '{ a: string; }'. Types of property 'a' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts (2 errors) ==== @@ -25,10 +22,7 @@ tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2322 !!! error TS2420: Types of property 'f' are incompatible. !!! error TS2420: Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void'. !!! error TS2420: Types of parameters 'a' and 'a' are incompatible. -!!! error TS2420: Type 'T' is not assignable to type '{ a: number; }'. -!!! error TS2420: Type '{ a: string; }' is not assignable to type '{ a: number; }'. -!!! error TS2420: Types of property 'a' are incompatible. -!!! error TS2420: Type 'string' is not assignable to type 'number'. +!!! error TS2420: Type '{ a: number; }' is not assignable to type 'T'. f(a: T): void { } } var x = new X<{ a: string }>(); @@ -38,7 +32,7 @@ tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2322 !!! error TS2322: Types of property 'f' are incompatible. !!! error TS2322: Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void'. !!! error TS2322: Types of parameters 'a' and 'a' are incompatible. -!!! error TS2322: Type '{ a: string; }' is not assignable to type '{ a: number; }'. +!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ a: string; }'. !!! error TS2322: Types of property 'a' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt index 7a128b87764..4652acc8d10 100644 --- a/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt +++ b/tests/baselines/reference/implementGenericWithMismatchedTypes.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(7,7): error TS2420: Types of property 'foo' are incompatible. Type '(x: string) => number' is not assignable to type '(x: T) => T'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'T'. + Type 'T' is not assignable to type 'string'. tests/cases/compiler/implementGenericWithMismatchedTypes.ts(16,7): error TS2420: Class 'C2' incorrectly implements interface 'IFoo2'. Types of property 'foo' are incompatible. Type '(x: Tstring) => number' is not assignable to type '(x: T) => T'. @@ -22,7 +22,7 @@ tests/cases/compiler/implementGenericWithMismatchedTypes.ts(16,7): error TS2420: !!! error TS2420: Types of property 'foo' are incompatible. !!! error TS2420: Type '(x: string) => number' is not assignable to type '(x: T) => T'. !!! error TS2420: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2420: Type 'string' is not assignable to type 'T'. +!!! error TS2420: Type 'T' is not assignable to type 'string'. foo(x: string): number { return null; } diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index e612600a7f8..cb6de6576b2 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -6,7 +6,7 @@ tests/cases/compiler/incompatibleTypes.ts(15,7): error TS2420: Class 'C2' incorr Types of property 'p1' are incompatible. Type '(n: number) => number' is not assignable to type '(s: string) => number'. Types of parameters 'n' and 's' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/incompatibleTypes.ts(25,7): error TS2420: Class 'C3' incorrectly implements interface 'IFoo3'. Types of property 'p1' are incompatible. Type 'number' is not assignable to type 'string'. @@ -52,7 +52,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => !!! error TS2420: Types of property 'p1' are incompatible. !!! error TS2420: Type '(n: number) => number' is not assignable to type '(s: string) => number'. !!! error TS2420: Types of parameters 'n' and 's' are incompatible. -!!! error TS2420: Type 'number' is not assignable to type 'string'. +!!! error TS2420: Type 'string' is not assignable to type 'number'. public p1(n:number) { return 0; } diff --git a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt index 237358b42de..df06eb1bd6c 100644 --- a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt +++ b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt @@ -1,10 +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'. - Property 'color' is missing in type 'IFrenchEye'. + Type 'IEye' is not assignable to type 'IFrenchEye'. + Property 'coleur' is missing in 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'. @@ -45,8 +44,8 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy ~~~~~~~~~~~ !!! 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'. -!!! error TS2345: Property 'color' is missing in type 'IFrenchEye'. +!!! error TS2345: Type 'IEye' is not assignable to type 'IFrenchEye'. +!!! error TS2345: Property 'coleur' is missing in type 'IEye'. // type of z inferred from specialized array type var z=x.sort(CompareEyes); // ok @@ -61,7 +60,6 @@ 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 ~~~~ diff --git a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt index ab784eae397..51fce2d29d4 100644 --- a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt +++ b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(7,6): error TS2345: Argument o Types of property 'thunk' are incompatible. Type '(num: number) => void' is not assignable to type '(str: string) => void'. Types of parameters 'num' and 'str' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(13,5): error TS2300: Duplicate identifier 'thunk'. @@ -32,7 +32,7 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate !!! error TS2345: Types of property 'thunk' are incompatible. !!! error TS2345: Type '(num: number) => void' is not assignable to type '(str: string) => void'. !!! error TS2345: Types of parameters 'num' and 'str' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. test({ // Should be OK. Last 'thunk' is of correct type thunk: (num: number) => {}, diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt b/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt index 52fb45e40d2..024c5c1ea2b 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt +++ b/tests/baselines/reference/optionalFunctionArgAssignability.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/optionalFunctionArgAssignability.ts(7,1): error TS2322: Type '(onFulFill?: (value: number) => U, onReject?: (reason: any) => U) => Promise' is not assignable to type '(onFulfill?: (value: string) => U, onReject?: (reason: any) => U) => Promise'. Types of parameters 'onFulFill' and 'onFulfill' are incompatible. - Type '(value: number) => any' is not assignable to type '(value: string) => any'. + Type '(value: string) => any' is not assignable to type '(value: number) => any'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -16,7 +16,7 @@ tests/cases/compiler/optionalFunctionArgAssignability.ts(7,1): error TS2322: Typ ~ !!! error TS2322: Type '(onFulFill?: (value: number) => U, onReject?: (reason: any) => U) => Promise' is not assignable to type '(onFulfill?: (value: string) => U, onReject?: (reason: any) => U) => Promise'. !!! error TS2322: Types of parameters 'onFulFill' and 'onFulfill' are incompatible. -!!! error TS2322: Type '(value: number) => any' is not assignable to type '(value: string) => any'. +!!! error TS2322: Type '(value: string) => any' is not assignable to type '(value: number) => any'. !!! error TS2322: Types of parameters 'value' and 'value' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt b/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt index de02509d124..5ab492540ac 100644 --- a/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt +++ b/tests/baselines/reference/optionalParamAssignmentCompat.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/optionalParamAssignmentCompat.ts(10,5): error TS2322: Type '(p1?: string) => I1' is not assignable to type 'I1'. Types of parameters 'p1' and 'p1' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/compiler/optionalParamAssignmentCompat.ts (1 errors) ==== @@ -17,5 +17,5 @@ tests/cases/compiler/optionalParamAssignmentCompat.ts(10,5): error TS2322: Type ~ !!! error TS2322: Type '(p1?: string) => I1' is not assignable to type 'I1'. !!! error TS2322: Types of parameters 'p1' and 'p1' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamTypeComparison.errors.txt b/tests/baselines/reference/optionalParamTypeComparison.errors.txt index 98a07570c65..287c1123211 100644 --- a/tests/baselines/reference/optionalParamTypeComparison.errors.txt +++ b/tests/baselines/reference/optionalParamTypeComparison.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/optionalParamTypeComparison.ts(4,1): error TS2322: Type '(s: string, b?: boolean) => void' is not assignable to type '(s: string, n?: number) => void'. Types of parameters 'b' and 'n' are incompatible. - Type 'boolean' is not assignable to type 'number'. + Type 'number' is not assignable to type 'boolean'. tests/cases/compiler/optionalParamTypeComparison.ts(5,1): error TS2322: Type '(s: string, n?: number) => void' is not assignable to type '(s: string, b?: boolean) => void'. Types of parameters 'n' and 'b' are incompatible. - Type 'number' is not assignable to type 'boolean'. + Type 'boolean' is not assignable to type 'number'. ==== tests/cases/compiler/optionalParamTypeComparison.ts (2 errors) ==== @@ -14,9 +14,9 @@ tests/cases/compiler/optionalParamTypeComparison.ts(5,1): error TS2322: Type '(s ~ !!! error TS2322: Type '(s: string, b?: boolean) => void' is not assignable to type '(s: string, n?: number) => void'. !!! error TS2322: Types of parameters 'b' and 'n' are incompatible. -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'boolean'. g = f; ~ !!! error TS2322: Type '(s: string, n?: number) => void' is not assignable to type '(s: string, b?: boolean) => void'. !!! error TS2322: Types of parameters 'n' and 'b' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index 45c9f99b691..5ca1e78de58 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -5,8 +5,8 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,5): 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' 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'. - Property 'x' is missing in type 'D'. + Type 'B' is not assignable to type 'D'. + Property 'q' is missing in type 'B'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,14): error TS2344: Type 'D' does not satisfy the constraint 'A'. @@ -49,6 +49,6 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,14): ~ !!! error TS2345: Argument of type '(x: D) => G' 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'. -!!! error TS2345: Property 'x' is missing in type 'D'. +!!! error TS2345: Type 'B' is not assignable to type 'D'. +!!! error TS2345: Property 'q' is missing in type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/promisePermutations.errors.txt b/tests/baselines/reference/promisePermutations.errors.txt index 4edfff05a5a..65fa0981643 100644 --- a/tests/baselines/reference/promisePermutations.errors.txt +++ b/tests/baselines/reference/promisePermutations.errors.txt @@ -1,18 +1,18 @@ tests/cases/compiler/promisePermutations.ts(74,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(79,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(84,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(88,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations.ts(92,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -23,16 +23,16 @@ tests/cases/compiler/promisePermutations.ts(101,19): error TS2345: Argument of t tests/cases/compiler/promisePermutations.ts(102,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations.ts(106,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(111,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations.ts(117,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations.ts(121,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. @@ -55,7 +55,7 @@ tests/cases/compiler/promisePermutations.ts(152,12): error TS2453: The type argu Types of property 'then' are incompatible. Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. + Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. Types of parameters 'value' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations.ts(156,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. @@ -72,7 +72,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t Types of property 'then' are incompatible. Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. + Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -155,7 +155,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -164,24 +164,24 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; @@ -223,24 +223,24 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -316,7 +316,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. !!! error TS2453: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2453: Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. +!!! error TS2453: Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. !!! error TS2453: Types of parameters 'value' and 'value' are incompatible. !!! error TS2453: Type 'string' is not assignable to type 'number'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -345,7 +345,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2345: Argument of t !!! error TS2345: Types of property 'then' are incompatible. !!! error TS2345: Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. !!! error TS2345: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2345: Type '(value: number) => Promise' is not assignable to type '(value: string) => IPromise'. +!!! error TS2345: Type '(value: string) => IPromise' is not assignable to type '(value: number) => Promise'. !!! error TS2345: Types of parameters 'value' and 'value' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/promisePermutations2.errors.txt b/tests/baselines/reference/promisePermutations2.errors.txt index dda9a08b38d..0fc6f04911a 100644 --- a/tests/baselines/reference/promisePermutations2.errors.txt +++ b/tests/baselines/reference/promisePermutations2.errors.txt @@ -1,18 +1,18 @@ tests/cases/compiler/promisePermutations2.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -23,16 +23,16 @@ tests/cases/compiler/promisePermutations2.ts(100,19): error TS2345: Argument of tests/cases/compiler/promisePermutations2.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations2.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(108,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations2.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations2.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. @@ -55,7 +55,7 @@ tests/cases/compiler/promisePermutations2.ts(151,12): error TS2453: The type arg Types of property 'then' are incompatible. Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. + Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. Types of parameters 'value' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations2.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. @@ -72,7 +72,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of Types of property 'then' are incompatible. Type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. + Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. @@ -154,7 +154,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -163,24 +163,24 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; @@ -222,24 +222,24 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -315,7 +315,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }' is not assignable to type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise'. !!! error TS2453: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2453: Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. +!!! error TS2453: Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. !!! error TS2453: Types of parameters 'value' and 'value' are incompatible. !!! error TS2453: Type 'string' is not assignable to type 'number'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -344,7 +344,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of !!! error TS2345: Types of property 'then' are incompatible. !!! error TS2345: Type '(success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void) => Promise' is not assignable to type '{ (success?: (value: string) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; }'. !!! error TS2345: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2345: Type '(value: number) => any' is not assignable to type '(value: string) => IPromise'. +!!! error TS2345: Type '(value: string) => IPromise' is not assignable to type '(value: number) => any'. !!! error TS2345: Types of parameters 'value' and 'value' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index c6c2bca62a4..a1a1b3f493f 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -1,21 +1,21 @@ tests/cases/compiler/promisePermutations3.ts(68,69): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(73,70): error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'IPromise'. + Type 'IPromise' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(78,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(81,19): error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(82,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(83,19): error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'x' and 'value' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(87,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(90,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(91,19): error TS2345: Argument of type '(x: number, cb: (a: string) => string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. @@ -26,16 +26,16 @@ tests/cases/compiler/promisePermutations3.ts(100,19): error TS2345: Argument of tests/cases/compiler/promisePermutations3.ts(101,19): error TS2345: Argument of type '(x: number, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. tests/cases/compiler/promisePermutations3.ts(105,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(108,19): error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(109,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(110,19): error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. Types of parameters 'cb' and 'value' are incompatible. - Type '(a: T) => T' is not assignable to type 'string'. + Type 'string' is not assignable to type '(a: T) => T'. tests/cases/compiler/promisePermutations3.ts(116,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(119,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: number) => IPromise'. tests/cases/compiler/promisePermutations3.ts(120,19): error TS2345: Argument of type '(x: T, cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: number) => Promise'. @@ -58,7 +58,7 @@ tests/cases/compiler/promisePermutations3.ts(151,12): error TS2453: The type arg Types of property 'then' are incompatible. Type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. + Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. Types of parameters 'value' and 'value' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/compiler/promisePermutations3.ts(155,21): error TS2345: Argument of type '{ (x: number): IPromise; (x: string): IPromise; }' is not assignable to parameter of type '(value: number) => IPromise'. @@ -75,7 +75,7 @@ tests/cases/compiler/promisePermutations3.ts(159,21): error TS2345: Argument of Types of property 'then' are incompatible. Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. Types of parameters 'success' and 'success' are incompatible. - Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. + Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. Types of parameters 'value' and 'value' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of type '{ (x: T): IPromise; (x: T, y: T): Promise; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise'. @@ -157,7 +157,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var s3: Promise; var s3a = s3.then(testFunction3, testFunction3, testFunction3); var s3b = s3.then(testFunction3P, testFunction3P, testFunction3P); @@ -166,7 +166,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => IPromise' is not assignable to parameter of type '(value: IPromise) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'IPromise'. +!!! error TS2345: Type 'IPromise' is not assignable to type 'number'. var r4: IPromise; var sIPromise: (x: any) => IPromise; @@ -175,24 +175,24 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var r4b = r4.then(sIPromise, testFunction4, testFunction4).then(sIPromise, testFunction4, testFunction4); // ok var s4: Promise; var s4a = s4.then(testFunction4, testFunction4, testFunction4); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4b = s4.then(testFunction4P, testFunction4P, testFunction4P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4c = s4.then(testFunction4P, testFunction4, testFunction4); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y?: string) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'x' and 'value' are incompatible. -!!! error TS2345: Type 'number' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. var s4d = s4.then(sIPromise, testFunction4P, testFunction4).then(sIPromise, testFunction4P, testFunction4); var r5: IPromise; @@ -234,24 +234,24 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var r7b = r7.then(sIPromise, sIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise); // ok var s7: Promise; var s7a = r7.then(testFunction7, testFunction7, testFunction7); // error ~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => IPromise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7b = r7.then(testFunction7P, testFunction7P, testFunction7P); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => Promise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7c = r7.then(testFunction7P, testFunction7, testFunction7); // error ~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(cb: (a: T) => T) => Promise' is not assignable to parameter of type '(value: string) => IPromise'. !!! error TS2345: Types of parameters 'cb' and 'value' are incompatible. -!!! error TS2345: Type '(a: T) => T' is not assignable to type 'string'. +!!! error TS2345: Type 'string' is not assignable to type '(a: T) => T'. var s7d = r7.then(sPromise, sPromise, sPromise).then(sPromise, sPromise, sPromise); // ok? var r8: IPromise; @@ -327,7 +327,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2453: Types of property 'then' are incompatible. !!! error TS2453: Type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise' is not assignable to type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }'. !!! error TS2453: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2453: Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. +!!! error TS2453: Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. !!! error TS2453: Types of parameters 'value' and 'value' are incompatible. !!! error TS2453: Type 'string' is not assignable to type 'number'. var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok @@ -356,7 +356,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of !!! error TS2345: Types of property 'then' are incompatible. !!! error TS2345: Type '{ (success?: (value: number) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; }' is not assignable to type '(success?: (value: string) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise'. !!! error TS2345: Types of parameters 'success' and 'success' are incompatible. -!!! error TS2345: Type '(value: number) => Promise' is not assignable to type '(value: string) => any'. +!!! error TS2345: Type '(value: string) => any' is not assignable to type '(value: number) => Promise'. !!! error TS2345: Types of parameters 'value' and 'value' are incompatible. !!! error TS2345: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/restArgAssignmentCompat.errors.txt b/tests/baselines/reference/restArgAssignmentCompat.errors.txt index c17d28cb28b..5be7e3f8d67 100644 --- a/tests/baselines/reference/restArgAssignmentCompat.errors.txt +++ b/tests/baselines/reference/restArgAssignmentCompat.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/restArgAssignmentCompat.ts(7,1): error TS2322: Type '(...x: number[]) => void' is not assignable to type '(x: number[], y: string) => void'. Types of parameters 'x' and 'x' are incompatible. - Type 'number' is not assignable to type 'number[]'. + Type 'number[]' is not assignable to type 'number'. ==== tests/cases/compiler/restArgAssignmentCompat.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/restArgAssignmentCompat.ts(7,1): error TS2322: Type '(...x: ~ !!! error TS2322: Type '(...x: number[]) => void' is not assignable to type '(x: number[], y: string) => void'. !!! error TS2322: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'number[]'. +!!! error TS2322: Type 'number[]' is not assignable to type 'number'. n([4], 'foo'); \ No newline at end of file diff --git a/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt b/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt index f4a141ff390..3d0e04bbfa7 100644 --- a/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt +++ b/tests/baselines/reference/subtypingWithCallSignaturesWithRestParameters.errors.txt @@ -2,57 +2,57 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW Types of property 'a' are incompatible. Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'args' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(34,11): error TS2430: Interface 'I3B' incorrectly extends interface 'Base'. Types of property 'a' are incompatible. Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. Types of parameters 'x' and 'args' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(60,11): error TS2430: Interface 'I6C' incorrectly extends interface 'Base'. Types of property 'a2' are incompatible. Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(90,11): error TS2430: Interface 'I10B' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(94,11): error TS2430: Interface 'I10C' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'z' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(98,11): error TS2430: Interface 'I10D' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'x' and 'x' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(102,11): error TS2430: Interface 'I10E' incorrectly extends interface 'Base'. Types of property 'a3' are incompatible. Type '(x: number, ...z: string[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. Types of parameters 'z' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(110,11): error TS2430: Interface 'I12' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(118,11): error TS2430: Interface 'I14' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'y' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(126,11): error TS2430: Interface 'I16' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'args' and 'z' are incompatible. - Type 'string' is not assignable to type 'number'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(130,11): error TS2430: Interface 'I17' incorrectly extends interface 'Base'. Types of property 'a4' are incompatible. Type '(...args: number[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. Types of parameters 'args' and 'y' are incompatible. - Type 'number' is not assignable to type 'string'. + Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts (11 errors) ==== @@ -79,7 +79,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'args' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a: (...args: string[]) => number; // error, type mismatch } @@ -101,7 +101,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a' are incompatible. !!! error TS2430: Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'. !!! error TS2430: Types of parameters 'x' and 'args' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a: (x?: string) => number; // error, incompatible type } @@ -133,7 +133,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a2' are incompatible. !!! error TS2430: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a2: (x: number, ...args: string[]) => number; // error } @@ -169,7 +169,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a3: (x: number, y?: number, z?: number) => number; // error } @@ -179,7 +179,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'z' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a3: (x: number, ...z: number[]) => number; // error } @@ -189,7 +189,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'x' and 'x' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a3: (x: string, y?: string, z?: string) => number; // error, incompatible types } @@ -199,7 +199,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a3' are incompatible. !!! error TS2430: Type '(x: number, ...z: string[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'z' and 'z' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a3: (x: number, ...z: string[]) => number; // error } @@ -213,7 +213,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a4: (x?: number, y?: number) => number; // error, type mismatch } @@ -227,7 +227,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'y' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a4: (x: number, y?: number) => number; // error, second param has type mismatch } @@ -241,7 +241,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'z' are incompatible. -!!! error TS2430: Type 'string' is not assignable to type 'number'. +!!! error TS2430: Type 'number' is not assignable to type 'string'. a4: (x: number, ...args: string[]) => number; // error, rest param has type mismatch } @@ -251,7 +251,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingW !!! error TS2430: Types of property 'a4' are incompatible. !!! error TS2430: Type '(...args: number[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'. !!! error TS2430: Types of parameters 'args' and 'y' are incompatible. -!!! error TS2430: Type 'number' is not assignable to type 'string'. +!!! error TS2430: Type 'string' is not assignable to type 'number'. a4: (...args: number[]) => number; // error } \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt index d058426b9c9..da01aa778b6 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.errors.txt @@ -2,13 +2,13 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct 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'. + Type 'number' is not assignable to type 'string'. 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'. + Type 'number' is not assignable to type 'string'. 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'. + Type 'number' is not assignable to type 'string'. 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'. @@ -90,7 +90,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct ~~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. new someGenerics4(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 @@ -104,7 +104,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct ~~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. new someGenerics5(null, null); // Generic call with multiple arguments of function types that each have parameters of the same generic type @@ -118,7 +118,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceConstruct ~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. new someGenerics6((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 diff --git a/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt b/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt index 9bd25dda4e6..36a17e166a5 100644 --- a/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceErrors.errors.txt @@ -1,13 +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'. + Type 'number' is not assignable to type 'string'. 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'. + Type 'number' is not assignable to type 'string'. 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'. + Type 'number' is not assignable to type 'string'. ==== tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts (4 errors) ==== @@ -23,7 +23,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts ~~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. // 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(n: T, f: (x: U) => void) { } @@ -31,7 +31,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts ~~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. // Generic call with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { } @@ -39,5 +39,5 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceErrors.ts ~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt index e6de840ec54..22d18e11eca 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.errors.txt @@ -5,14 +5,14 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst 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'. + Type 'number' is not assignable to type 'string'. 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'. + Type 'number' is not assignable to type 'string'. 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'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConstraints.ts(66,31): error TS2345: Argument of type '(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'. @@ -81,7 +81,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst ~~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. someGenerics4(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,7 +92,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst ~~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. someGenerics5(null, null); // Error ~~~~~~ !!! error TS2344: Type 'string' does not satisfy the constraint 'number'. @@ -105,7 +105,7 @@ tests/cases/conformance/expressions/functionCalls/typeArgumentInferenceWithConst ~~~~~~~~~~~~~~~~ !!! 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'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. someGenerics6((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 diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt index f47266f2850..39e6db64fbf 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'T' is not assignable to type 'number'. + Type 'number' is not assignable to type 'T'. tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'number' is not assignable to type 'T'. + Type 'T' is not assignable to type 'number'. ==== tests/cases/compiler/typeParameterArgumentEquivalence.ts (2 errors) ==== @@ -14,11 +14,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence.ts(5,5): error TS2322: Typ ~ !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: number) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'T' is not assignable to type 'number'. +!!! error TS2322: Type 'number' is not assignable to type 'T'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: number) => boolean' is not assignable to type '(item: T) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type 'T'. +!!! error TS2322: Type 'T' is not assignable to type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt index 2aa8d77ba6d..17fce0384f7 100644 --- a/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt +++ b/tests/baselines/reference/typeParameterArgumentEquivalence2.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(4,5): error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'T' is not assignable to type 'U'. + Type 'U' is not assignable to type 'T'. tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. Types of parameters 'item' and 'item' are incompatible. - Type 'U' is not assignable to type 'T'. + Type 'T' is not assignable to type 'U'. ==== tests/cases/compiler/typeParameterArgumentEquivalence2.ts (2 errors) ==== @@ -14,11 +14,11 @@ tests/cases/compiler/typeParameterArgumentEquivalence2.ts(5,5): error TS2322: Ty ~ !!! error TS2322: Type '(item: T) => boolean' is not assignable to type '(item: U) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'T' is not assignable to type 'U'. +!!! error TS2322: Type 'U' is not assignable to type 'T'. y = x; // Shound be an error ~ !!! error TS2322: Type '(item: U) => boolean' is not assignable to type '(item: T) => boolean'. !!! error TS2322: Types of parameters 'item' and 'item' are incompatible. -!!! error TS2322: Type 'U' is not assignable to type 'T'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. } \ No newline at end of file From e7f415d5e517a1020da52dbd8d4d476a730507d0 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 22 Feb 2016 11:50:52 -0800 Subject: [PATCH 10/11] Merge pull request #7163 from Microsoft/cachePairs do not make inferences with the same source\target pair multiple times --- src/compiler/checker.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e6d3ec5ccea..b4427dbb690 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6446,6 +6446,7 @@ namespace ts { let targetStack: Type[]; let depth = 0; let inferiority = 0; + const visited: Map = {}; inferFromTypes(source, target); function isInProcess(source: Type, target: Type) { @@ -6575,6 +6576,12 @@ namespace ts { return; } + const key = source.id + "," + target.id; + if (hasProperty(visited, key)) { + return; + } + visited[key] = true; + if (depth === 0) { sourceStack = []; targetStack = []; From 365e5446da2f4f042e37a55f09187095c3764913 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 3 Mar 2016 12:18:49 -0800 Subject: [PATCH 11/11] Merge pull request #7373 from Microsoft/limitInferenceDepth set the maximum depth to explore during type inference --- src/compiler/checker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b4427dbb690..44713b2c1db 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6444,6 +6444,7 @@ namespace ts { function inferTypes(context: InferenceContext, source: Type, target: Type) { let sourceStack: Type[]; let targetStack: Type[]; + const maxDepth = 5; let depth = 0; let inferiority = 0; const visited: Map = {}; @@ -6572,6 +6573,11 @@ namespace ts { if (isInProcess(source, target)) { return; } + // we delibirately limit the depth we examine to infer types: this speeds up the overall inference process + // and user rarely expects inferences to be made from the deeply nested constituents. + if (depth > maxDepth) { + return; + } if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) { return; }