From cd88f6a3199c40ef9a0fcaeffa8c36a554fb070d Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 13 Jan 2019 13:30:58 -0500 Subject: [PATCH 01/48] Added error for class properties used within their own declaration Fixes #5987. Usages of a class property in a preceding property already gave an error, but the following doesn't yet: ```ts class Test { x: number = this.x; } ``` As with other use-before-declare checking, IIFEs are not treated as invalid uses. --- src/compiler/checker.ts | 43 ++++++ ...sUsedBeforeInitializedVariables.errors.txt | 66 ++++++++++ .../classUsedBeforeInitializedVariables.js | 102 +++++++++++++++ ...lassUsedBeforeInitializedVariables.symbols | 97 ++++++++++++++ .../classUsedBeforeInitializedVariables.types | 122 ++++++++++++++++++ .../classUsedBeforeInitializedVariables.ts | 40 ++++++ 6 files changed, 470 insertions(+) create mode 100644 tests/baselines/reference/classUsedBeforeInitializedVariables.errors.txt create mode 100644 tests/baselines/reference/classUsedBeforeInitializedVariables.js create mode 100644 tests/baselines/reference/classUsedBeforeInitializedVariables.symbols create mode 100644 tests/baselines/reference/classUsedBeforeInitializedVariables.types create mode 100644 tests/cases/compiler/classUsedBeforeInitializedVariables.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b1f73584c49..2fc7841ae39 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1118,6 +1118,9 @@ namespace ts { // still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} }) return !findAncestor(usage, n => isComputedPropertyName(n) && n.parent.parent === declaration); } + else if (isPropertyDeclaration(declaration)) { + return isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage); + } return true; } @@ -1192,6 +1195,40 @@ namespace ts { return false; }); } + + function isPropertyImmediatelyReferencedWithinDeclaration(declaration: PropertyDeclaration, usage: Node) { + // always legal if usage is after declaration + if (usage.end > declaration.end) { + return true; + } + + // still might be legal if usage is deferred (e.g. x: any = () => this.x) + // otherwise illegal if immediately referenced within the declaration (e.g. x: any = this.x) + const ancestorChangingReferenceScope = findAncestor(usage, (node: Node) => { + if (node === declaration) { + return "quit"; + } + + switch (node.kind) { + case SyntaxKind.ArrowFunction: + case SyntaxKind.PropertyDeclaration: + return true; + case SyntaxKind.Block: + switch (node.parent.kind) { + case SyntaxKind.GetAccessor: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.SetAccessor: + return true; + default: + return false; + } + default: + return false; + } + }); + + return ancestorChangingReferenceScope !== undefined && ancestorChangingReferenceScope !== declaration; + } } /** @@ -19140,6 +19177,12 @@ namespace ts { case SyntaxKind.PropertyAssignment: // We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`. return false; + case SyntaxKind.ExpressionWithTypeArguments: + case SyntaxKind.HeritageClause: + case SyntaxKind.ComputedPropertyName: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return false; default: return isExpressionNode(node) ? false : "quit"; } diff --git a/tests/baselines/reference/classUsedBeforeInitializedVariables.errors.txt b/tests/baselines/reference/classUsedBeforeInitializedVariables.errors.txt new file mode 100644 index 00000000000..685c854039e --- /dev/null +++ b/tests/baselines/reference/classUsedBeforeInitializedVariables.errors.txt @@ -0,0 +1,66 @@ +tests/cases/compiler/classUsedBeforeInitializedVariables.ts(4,15): error TS2729: Property 'p4' is used before its initialization. +tests/cases/compiler/classUsedBeforeInitializedVariables.ts(7,34): error TS2729: Property 'directlyAssigned' is used before its initialization. +tests/cases/compiler/classUsedBeforeInitializedVariables.ts(16,15): error TS2729: Property 'withinObjectLiteral' is used before its initialization. +tests/cases/compiler/classUsedBeforeInitializedVariables.ts(20,19): error TS2729: Property 'withinObjectLiteralGetterName' is used before its initialization. +tests/cases/compiler/classUsedBeforeInitializedVariables.ts(26,19): error TS2729: Property 'withinObjectLiteralSetterName' is used before its initialization. +tests/cases/compiler/classUsedBeforeInitializedVariables.ts(29,64): error TS2729: Property 'withinClassDeclarationExtension' is used before its initialization. + + +==== tests/cases/compiler/classUsedBeforeInitializedVariables.ts (6 errors) ==== + class Test { + p1 = 0; + p2 = this.p1; + p3 = this.p4; + ~~ +!!! error TS2729: Property 'p4' is used before its initialization. +!!! related TS2728 tests/cases/compiler/classUsedBeforeInitializedVariables.ts:5:5: 'p4' is declared here. + p4 = 0; + + directlyAssigned: any = this.directlyAssigned; + ~~~~~~~~~~~~~~~~ +!!! error TS2729: Property 'directlyAssigned' is used before its initialization. +!!! related TS2728 tests/cases/compiler/classUsedBeforeInitializedVariables.ts:7:5: 'directlyAssigned' is declared here. + + withinArrowFunction: any = () => this.withinArrowFunction; + + withinFunction: any = function () { + return this.withinFunction; + }; + + withinObjectLiteral: any = { + [this.withinObjectLiteral]: true, + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2729: Property 'withinObjectLiteral' is used before its initialization. +!!! related TS2728 tests/cases/compiler/classUsedBeforeInitializedVariables.ts:15:5: 'withinObjectLiteral' is declared here. + }; + + withinObjectLiteralGetterName: any = { + get [this.withinObjectLiteralGetterName]() { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2729: Property 'withinObjectLiteralGetterName' is used before its initialization. +!!! related TS2728 tests/cases/compiler/classUsedBeforeInitializedVariables.ts:19:5: 'withinObjectLiteralGetterName' is declared here. + return true; + } + }; + + withinObjectLiteralSetterName: any = { + set [this.withinObjectLiteralSetterName](_: any) {} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2729: Property 'withinObjectLiteralSetterName' is used before its initialization. +!!! related TS2728 tests/cases/compiler/classUsedBeforeInitializedVariables.ts:25:5: 'withinObjectLiteralSetterName' is declared here. + }; + + withinClassDeclarationExtension: any = (class extends this.withinClassDeclarationExtension { }); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2729: Property 'withinClassDeclarationExtension' is used before its initialization. +!!! related TS2728 tests/cases/compiler/classUsedBeforeInitializedVariables.ts:29:5: 'withinClassDeclarationExtension' is declared here. + + // These error cases are ignored (not checked by control flow analysis) + + assignedByArrowFunction: any = (() => this.assignedByFunction)(); + + assignedByFunction: any = (function () { + return this.assignedByFunction; + })(); + } + \ No newline at end of file diff --git a/tests/baselines/reference/classUsedBeforeInitializedVariables.js b/tests/baselines/reference/classUsedBeforeInitializedVariables.js new file mode 100644 index 00000000000..3a3591cfdad --- /dev/null +++ b/tests/baselines/reference/classUsedBeforeInitializedVariables.js @@ -0,0 +1,102 @@ +//// [classUsedBeforeInitializedVariables.ts] +class Test { + p1 = 0; + p2 = this.p1; + p3 = this.p4; + p4 = 0; + + directlyAssigned: any = this.directlyAssigned; + + withinArrowFunction: any = () => this.withinArrowFunction; + + withinFunction: any = function () { + return this.withinFunction; + }; + + withinObjectLiteral: any = { + [this.withinObjectLiteral]: true, + }; + + withinObjectLiteralGetterName: any = { + get [this.withinObjectLiteralGetterName]() { + return true; + } + }; + + withinObjectLiteralSetterName: any = { + set [this.withinObjectLiteralSetterName](_: any) {} + }; + + withinClassDeclarationExtension: any = (class extends this.withinClassDeclarationExtension { }); + + // These error cases are ignored (not checked by control flow analysis) + + assignedByArrowFunction: any = (() => this.assignedByFunction)(); + + assignedByFunction: any = (function () { + return this.assignedByFunction; + })(); +} + + +//// [classUsedBeforeInitializedVariables.js] +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var Test = /** @class */ (function () { + function Test() { + var _a, _b, _c; + var _this = this; + this.p1 = 0; + this.p2 = this.p1; + this.p3 = this.p4; + this.p4 = 0; + this.directlyAssigned = this.directlyAssigned; + this.withinArrowFunction = function () { return _this.withinArrowFunction; }; + this.withinFunction = function () { + return this.withinFunction; + }; + this.withinObjectLiteral = (_a = {}, + _a[this.withinObjectLiteral] = true, + _a); + this.withinObjectLiteralGetterName = (_b = {}, + Object.defineProperty(_b, this.withinObjectLiteralGetterName, { + get: function () { + return true; + }, + enumerable: true, + configurable: true + }), + _b); + this.withinObjectLiteralSetterName = (_c = {}, + Object.defineProperty(_c, this.withinObjectLiteralSetterName, { + set: function (_) { }, + enumerable: true, + configurable: true + }), + _c); + this.withinClassDeclarationExtension = (/** @class */ (function (_super) { + __extends(class_1, _super); + function class_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + return class_1; + }(this.withinClassDeclarationExtension))); + // These error cases are ignored (not checked by control flow analysis) + this.assignedByArrowFunction = (function () { return _this.assignedByFunction; })(); + this.assignedByFunction = (function () { + return this.assignedByFunction; + })(); + } + return Test; +}()); diff --git a/tests/baselines/reference/classUsedBeforeInitializedVariables.symbols b/tests/baselines/reference/classUsedBeforeInitializedVariables.symbols new file mode 100644 index 00000000000..4885953ed58 --- /dev/null +++ b/tests/baselines/reference/classUsedBeforeInitializedVariables.symbols @@ -0,0 +1,97 @@ +=== tests/cases/compiler/classUsedBeforeInitializedVariables.ts === +class Test { +>Test : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) + + p1 = 0; +>p1 : Symbol(Test.p1, Decl(classUsedBeforeInitializedVariables.ts, 0, 12)) + + p2 = this.p1; +>p2 : Symbol(Test.p2, Decl(classUsedBeforeInitializedVariables.ts, 1, 11)) +>this.p1 : Symbol(Test.p1, Decl(classUsedBeforeInitializedVariables.ts, 0, 12)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>p1 : Symbol(Test.p1, Decl(classUsedBeforeInitializedVariables.ts, 0, 12)) + + p3 = this.p4; +>p3 : Symbol(Test.p3, Decl(classUsedBeforeInitializedVariables.ts, 2, 17)) +>this.p4 : Symbol(Test.p4, Decl(classUsedBeforeInitializedVariables.ts, 3, 17)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>p4 : Symbol(Test.p4, Decl(classUsedBeforeInitializedVariables.ts, 3, 17)) + + p4 = 0; +>p4 : Symbol(Test.p4, Decl(classUsedBeforeInitializedVariables.ts, 3, 17)) + + directlyAssigned: any = this.directlyAssigned; +>directlyAssigned : Symbol(Test.directlyAssigned, Decl(classUsedBeforeInitializedVariables.ts, 4, 11)) +>this.directlyAssigned : Symbol(Test.directlyAssigned, Decl(classUsedBeforeInitializedVariables.ts, 4, 11)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>directlyAssigned : Symbol(Test.directlyAssigned, Decl(classUsedBeforeInitializedVariables.ts, 4, 11)) + + withinArrowFunction: any = () => this.withinArrowFunction; +>withinArrowFunction : Symbol(Test.withinArrowFunction, Decl(classUsedBeforeInitializedVariables.ts, 6, 50)) +>this.withinArrowFunction : Symbol(Test.withinArrowFunction, Decl(classUsedBeforeInitializedVariables.ts, 6, 50)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>withinArrowFunction : Symbol(Test.withinArrowFunction, Decl(classUsedBeforeInitializedVariables.ts, 6, 50)) + + withinFunction: any = function () { +>withinFunction : Symbol(Test.withinFunction, Decl(classUsedBeforeInitializedVariables.ts, 8, 62)) + + return this.withinFunction; + }; + + withinObjectLiteral: any = { +>withinObjectLiteral : Symbol(Test.withinObjectLiteral, Decl(classUsedBeforeInitializedVariables.ts, 12, 6)) + + [this.withinObjectLiteral]: true, +>[this.withinObjectLiteral] : Symbol([this.withinObjectLiteral], Decl(classUsedBeforeInitializedVariables.ts, 14, 32)) +>this.withinObjectLiteral : Symbol(Test.withinObjectLiteral, Decl(classUsedBeforeInitializedVariables.ts, 12, 6)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>withinObjectLiteral : Symbol(Test.withinObjectLiteral, Decl(classUsedBeforeInitializedVariables.ts, 12, 6)) + + }; + + withinObjectLiteralGetterName: any = { +>withinObjectLiteralGetterName : Symbol(Test.withinObjectLiteralGetterName, Decl(classUsedBeforeInitializedVariables.ts, 16, 6)) + + get [this.withinObjectLiteralGetterName]() { +>[this.withinObjectLiteralGetterName] : Symbol([this.withinObjectLiteralGetterName], Decl(classUsedBeforeInitializedVariables.ts, 18, 42)) +>this.withinObjectLiteralGetterName : Symbol(Test.withinObjectLiteralGetterName, Decl(classUsedBeforeInitializedVariables.ts, 16, 6)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>withinObjectLiteralGetterName : Symbol(Test.withinObjectLiteralGetterName, Decl(classUsedBeforeInitializedVariables.ts, 16, 6)) + + return true; + } + }; + + withinObjectLiteralSetterName: any = { +>withinObjectLiteralSetterName : Symbol(Test.withinObjectLiteralSetterName, Decl(classUsedBeforeInitializedVariables.ts, 22, 6)) + + set [this.withinObjectLiteralSetterName](_: any) {} +>[this.withinObjectLiteralSetterName] : Symbol([this.withinObjectLiteralSetterName], Decl(classUsedBeforeInitializedVariables.ts, 24, 42)) +>this.withinObjectLiteralSetterName : Symbol(Test.withinObjectLiteralSetterName, Decl(classUsedBeforeInitializedVariables.ts, 22, 6)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>withinObjectLiteralSetterName : Symbol(Test.withinObjectLiteralSetterName, Decl(classUsedBeforeInitializedVariables.ts, 22, 6)) +>_ : Symbol(_, Decl(classUsedBeforeInitializedVariables.ts, 25, 49)) + + }; + + withinClassDeclarationExtension: any = (class extends this.withinClassDeclarationExtension { }); +>withinClassDeclarationExtension : Symbol(Test.withinClassDeclarationExtension, Decl(classUsedBeforeInitializedVariables.ts, 26, 6)) +>this.withinClassDeclarationExtension : Symbol(Test.withinClassDeclarationExtension, Decl(classUsedBeforeInitializedVariables.ts, 26, 6)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>withinClassDeclarationExtension : Symbol(Test.withinClassDeclarationExtension, Decl(classUsedBeforeInitializedVariables.ts, 26, 6)) + + // These error cases are ignored (not checked by control flow analysis) + + assignedByArrowFunction: any = (() => this.assignedByFunction)(); +>assignedByArrowFunction : Symbol(Test.assignedByArrowFunction, Decl(classUsedBeforeInitializedVariables.ts, 28, 100)) +>this.assignedByFunction : Symbol(Test.assignedByFunction, Decl(classUsedBeforeInitializedVariables.ts, 32, 69)) +>this : Symbol(Test, Decl(classUsedBeforeInitializedVariables.ts, 0, 0)) +>assignedByFunction : Symbol(Test.assignedByFunction, Decl(classUsedBeforeInitializedVariables.ts, 32, 69)) + + assignedByFunction: any = (function () { +>assignedByFunction : Symbol(Test.assignedByFunction, Decl(classUsedBeforeInitializedVariables.ts, 32, 69)) + + return this.assignedByFunction; + })(); +} + diff --git a/tests/baselines/reference/classUsedBeforeInitializedVariables.types b/tests/baselines/reference/classUsedBeforeInitializedVariables.types new file mode 100644 index 00000000000..f10bf48a8ef --- /dev/null +++ b/tests/baselines/reference/classUsedBeforeInitializedVariables.types @@ -0,0 +1,122 @@ +=== tests/cases/compiler/classUsedBeforeInitializedVariables.ts === +class Test { +>Test : Test + + p1 = 0; +>p1 : number +>0 : 0 + + p2 = this.p1; +>p2 : number +>this.p1 : number +>this : this +>p1 : number + + p3 = this.p4; +>p3 : number +>this.p4 : number +>this : this +>p4 : number + + p4 = 0; +>p4 : number +>0 : 0 + + directlyAssigned: any = this.directlyAssigned; +>directlyAssigned : any +>this.directlyAssigned : any +>this : this +>directlyAssigned : any + + withinArrowFunction: any = () => this.withinArrowFunction; +>withinArrowFunction : any +>() => this.withinArrowFunction : () => any +>this.withinArrowFunction : any +>this : this +>withinArrowFunction : any + + withinFunction: any = function () { +>withinFunction : any +>function () { return this.withinFunction; } : () => any + + return this.withinFunction; +>this.withinFunction : any +>this : any +>withinFunction : any + + }; + + withinObjectLiteral: any = { +>withinObjectLiteral : any +>{ [this.withinObjectLiteral]: true, } : { [x: number]: boolean; } + + [this.withinObjectLiteral]: true, +>[this.withinObjectLiteral] : boolean +>this.withinObjectLiteral : any +>this : this +>withinObjectLiteral : any +>true : true + + }; + + withinObjectLiteralGetterName: any = { +>withinObjectLiteralGetterName : any +>{ get [this.withinObjectLiteralGetterName]() { return true; } } : { [x: number]: boolean; } + + get [this.withinObjectLiteralGetterName]() { +>[this.withinObjectLiteralGetterName] : boolean +>this.withinObjectLiteralGetterName : any +>this : this +>withinObjectLiteralGetterName : any + + return true; +>true : true + } + }; + + withinObjectLiteralSetterName: any = { +>withinObjectLiteralSetterName : any +>{ set [this.withinObjectLiteralSetterName](_: any) {} } : { [x: number]: any; } + + set [this.withinObjectLiteralSetterName](_: any) {} +>[this.withinObjectLiteralSetterName] : any +>this.withinObjectLiteralSetterName : any +>this : this +>withinObjectLiteralSetterName : any +>_ : any + + }; + + withinClassDeclarationExtension: any = (class extends this.withinClassDeclarationExtension { }); +>withinClassDeclarationExtension : any +>(class extends this.withinClassDeclarationExtension { }) : typeof (Anonymous class) +>class extends this.withinClassDeclarationExtension { } : typeof (Anonymous class) +>this.withinClassDeclarationExtension : any +>this : this +>withinClassDeclarationExtension : any + + // These error cases are ignored (not checked by control flow analysis) + + assignedByArrowFunction: any = (() => this.assignedByFunction)(); +>assignedByArrowFunction : any +>(() => this.assignedByFunction)() : any +>(() => this.assignedByFunction) : () => any +>() => this.assignedByFunction : () => any +>this.assignedByFunction : any +>this : this +>assignedByFunction : any + + assignedByFunction: any = (function () { +>assignedByFunction : any +>(function () { return this.assignedByFunction; })() : any +>(function () { return this.assignedByFunction; }) : () => any +>function () { return this.assignedByFunction; } : () => any + + return this.assignedByFunction; +>this.assignedByFunction : any +>this : any +>assignedByFunction : any + + })(); +} + diff --git a/tests/cases/compiler/classUsedBeforeInitializedVariables.ts b/tests/cases/compiler/classUsedBeforeInitializedVariables.ts new file mode 100644 index 00000000000..f10ae4e20a0 --- /dev/null +++ b/tests/cases/compiler/classUsedBeforeInitializedVariables.ts @@ -0,0 +1,40 @@ +// @target: es5 + +class Test { + p1 = 0; + p2 = this.p1; + p3 = this.p4; + p4 = 0; + + directlyAssigned: any = this.directlyAssigned; + + withinArrowFunction: any = () => this.withinArrowFunction; + + withinFunction: any = function () { + return this.withinFunction; + }; + + withinObjectLiteral: any = { + [this.withinObjectLiteral]: true, + }; + + withinObjectLiteralGetterName: any = { + get [this.withinObjectLiteralGetterName]() { + return true; + } + }; + + withinObjectLiteralSetterName: any = { + set [this.withinObjectLiteralSetterName](_: any) {} + }; + + withinClassDeclarationExtension: any = (class extends this.withinClassDeclarationExtension { }); + + // These error cases are ignored (not checked by control flow analysis) + + assignedByArrowFunction: any = (() => this.assignedByFunction)(); + + assignedByFunction: any = (function () { + return this.assignedByFunction; + })(); +} From 38e1856945d9509e3f12feb285f3917bd4558524 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 14 Jan 2019 17:30:42 -0500 Subject: [PATCH 02/48] Accepted 'witness' baselines; removed unnecessary !== --- src/compiler/checker.ts | 2 +- tests/baselines/reference/witness.errors.txt | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2fc7841ae39..b834cb3a89b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1227,7 +1227,7 @@ namespace ts { } }); - return ancestorChangingReferenceScope !== undefined && ancestorChangingReferenceScope !== declaration; + return ancestorChangingReferenceScope !== undefined; } } diff --git a/tests/baselines/reference/witness.errors.txt b/tests/baselines/reference/witness.errors.txt index e2475741189..cf21a8b2ed2 100644 --- a/tests/baselines/reference/witness.errors.txt +++ b/tests/baselines/reference/witness.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/types/witness/witness.ts(4,21): error TS2372: Parameter 'pInit' cannot be referenced in its initializer. +tests/cases/conformance/types/witness/witness.ts(8,14): error TS2729: Property 'x' is used before its initialization. tests/cases/conformance/types/witness/witness.ts(28,12): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/types/witness/witness.ts(29,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'co1' must be of type 'any', but here has type 'number'. tests/cases/conformance/types/witness/witness.ts(30,12): error TS2695: Left side of comma operator is unused and has no side effects. @@ -12,9 +13,11 @@ tests/cases/conformance/types/witness/witness.ts(39,5): error TS2403: Subsequent tests/cases/conformance/types/witness/witness.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'cnd1' must be of type 'any', but here has type 'number'. tests/cases/conformance/types/witness/witness.ts(57,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'and1' must be of type 'any', but here has type 'string'. tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'propAcc1' must be of type 'any', but here has type '{ m: any; }'. +tests/cases/conformance/types/witness/witness.ts(121,14): error TS2729: Property 'n' is used before its initialization. +tests/cases/conformance/types/witness/witness.ts(128,19): error TS2729: Property 'q' is used before its initialization. -==== tests/cases/conformance/types/witness/witness.ts (14 errors) ==== +==== tests/cases/conformance/types/witness/witness.ts (17 errors) ==== // Initializers var varInit = varInit; // any var pInit: any; @@ -25,6 +28,9 @@ tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequen } class InitClass { x = this.x; + ~ +!!! error TS2729: Property 'x' is used before its initialization. +!!! related TS2728 tests/cases/conformance/types/witness/witness.ts:8:5: 'x' is declared here. fn() { var y = this.x; var y: any; @@ -164,6 +170,9 @@ tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequen // Property access of class instance type class C2 { n = this.n; // n: any + ~ +!!! error TS2729: Property 'n' is used before its initialization. +!!! related TS2728 tests/cases/conformance/types/witness/witness.ts:121:5: 'n' is declared here. } var c2inst = new C2().n; var c2inst: any; @@ -171,6 +180,9 @@ tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequen // Constructor function property access class C3 { static q = C3.q; + ~ +!!! error TS2729: Property 'q' is used before its initialization. +!!! related TS2728 tests/cases/conformance/types/witness/witness.ts:128:12: 'q' is declared here. } var qq = C3.q; var qq: any; From 09747e5c35a89d5911093d65e409e554dc8bed2f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 20 Mar 2019 13:59:12 -0700 Subject: [PATCH 03/48] Add test for current --incremental behaviour --- .../unittests/config/commandLineParsing.ts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 26a49df3dbb..c5a6c9a4869 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -365,6 +365,23 @@ namespace ts { } }); }); + + it("parse --incremental", () => { + // --lib es6 0.ts + assertParseResult(["--incremental", "0.ts"], + { + errors: [{ + messageText: "Option 'incremental' can only be specified in 'tsconfig.json' file.", + category: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file.category, + code: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file.code, + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: {} + }); + }); }); describe("unittests:: config:: commandLineParsing:: parseBuildOptions", () => { @@ -456,6 +473,23 @@ namespace ts { }); }); + it("parse build with --incremental ", () => { + // --lib es6 0.ts + assertParseResult(["--incremental", "tests"], + { + errors: [{ + messageText: "Unknown build option '--incremental'.", + category: Diagnostics.Unknown_build_option_0.category, + code: Diagnostics.Unknown_build_option_0.code, + file: undefined, + start: undefined, + length: undefined, + }], + projects: ["tests"], + buildOptions: { } + }); + }); + describe("Combining options that make no sense together", () => { function verifyInvalidCombination(flag1: keyof BuildOptions, flag2: keyof BuildOptions) { it(`--${flag1} and --${flag2} together is invalid`, () => { From 34c3233d1837d654632df772d28fd191ed3f180b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 20 Mar 2019 14:44:14 -0700 Subject: [PATCH 04/48] Allow --incremental to be command line option --- src/compiler/commandLineParser.ts | 14 ++++++------ src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/program.ts | 4 ++++ src/compiler/tsbuild.ts | 3 ++- .../unittests/config/commandLineParsing.ts | 22 ++++--------------- .../reference/invalidIncremental.errors.txt | 8 +++++++ .../baselines/reference/invalidIncremental.js | 7 ++++++ .../reference/invalidIncremental.symbols | 5 +++++ .../reference/invalidIncremental.types | 6 +++++ .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- tests/cases/compiler/invalidIncremental.ts | 4 ++++ 19 files changed, 60 insertions(+), 35 deletions(-) create mode 100644 tests/baselines/reference/invalidIncremental.errors.txt create mode 100644 tests/baselines/reference/invalidIncremental.js create mode 100644 tests/baselines/reference/invalidIncremental.symbols create mode 100644 tests/baselines/reference/invalidIncremental.types create mode 100644 tests/cases/compiler/invalidIncremental.ts diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 3c4b0577fb6..a200ebf67e0 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -136,6 +136,13 @@ namespace ts { category: Diagnostics.Advanced_Options, description: Diagnostics.Show_verbose_diagnostic_information }, + { + name: "incremental", + shortName: "i", + type: "boolean", + category: Diagnostics.Basic_Options, + description: Diagnostics.Enable_incremental_compilation, + }, ]; /* @internal */ @@ -331,13 +338,6 @@ namespace ts { category: Diagnostics.Basic_Options, description: Diagnostics.Enable_project_compilation, }, - { - name: "incremental", - type: "boolean", - isTSConfigOnly: true, - category: Diagnostics.Basic_Options, - description: Diagnostics.Enable_incremental_compilation, - }, { name: "tsBuildInfoFile", type: "string", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9ae3e1ca77e..acc9a437ca1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3072,6 +3072,10 @@ "category": "Error", "code": 5073 }, + "Option '--incremental' can only be speicified when using tsconfig.": { + "category": "Error", + "code": 5074 + }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 979423cdfaa..2d8c4d5e4c3 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2722,6 +2722,10 @@ namespace ts { createDiagnosticForOptionName(Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option, "paths"); } + if (options.incremental && !options.configFilePath) { + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_speicified_when_using_tsconfig)); + } + if (options.composite) { if (options.declaration === false) { createDiagnosticForOptionName(Diagnostics.Composite_projects_may_not_disable_declaration_emit, "declaration"); diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index cc79c02f1d6..16e6e42272e 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -30,6 +30,7 @@ namespace ts { listEmittedFiles?: boolean; listFiles?: boolean; pretty?: boolean; + incremental?: boolean; traceResolution?: boolean; /* @internal */ diagnostics?: boolean; @@ -363,7 +364,7 @@ namespace ts { function getCompilerOptionsOfBuildOptions(buildOptions: BuildOptions): CompilerOptions { const result = {} as CompilerOptions; commonOptionsWithBuild.forEach(option => { - result[option.name] = buildOptions[option.name]; + if (hasProperty(buildOptions, option.name)) result[option.name] = buildOptions[option.name]; }); return result; } diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index c5a6c9a4869..33716841b79 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -370,16 +370,9 @@ namespace ts { // --lib es6 0.ts assertParseResult(["--incremental", "0.ts"], { - errors: [{ - messageText: "Option 'incremental' can only be specified in 'tsconfig.json' file.", - category: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file.category, - code: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file.code, - file: undefined, - start: undefined, - length: undefined, - }], + errors: [], fileNames: ["0.ts"], - options: {} + options: { incremental: true } }); }); }); @@ -477,16 +470,9 @@ namespace ts { // --lib es6 0.ts assertParseResult(["--incremental", "tests"], { - errors: [{ - messageText: "Unknown build option '--incremental'.", - category: Diagnostics.Unknown_build_option_0.category, - code: Diagnostics.Unknown_build_option_0.code, - file: undefined, - start: undefined, - length: undefined, - }], + errors: [], projects: ["tests"], - buildOptions: { } + buildOptions: { incremental: true } }); }); diff --git a/tests/baselines/reference/invalidIncremental.errors.txt b/tests/baselines/reference/invalidIncremental.errors.txt new file mode 100644 index 00000000000..6b6382e8f2e --- /dev/null +++ b/tests/baselines/reference/invalidIncremental.errors.txt @@ -0,0 +1,8 @@ +error TS5074: Option '--incremental' can only be speicified when using tsconfig. + + +!!! error TS5074: Option '--incremental' can only be speicified when using tsconfig. +==== tests/cases/compiler/invalidIncremental.ts (0 errors) ==== + const x = 10; + + \ No newline at end of file diff --git a/tests/baselines/reference/invalidIncremental.js b/tests/baselines/reference/invalidIncremental.js new file mode 100644 index 00000000000..4798b1d4fa3 --- /dev/null +++ b/tests/baselines/reference/invalidIncremental.js @@ -0,0 +1,7 @@ +//// [invalidIncremental.ts] +const x = 10; + + + +//// [invalidIncremental.js] +var x = 10; diff --git a/tests/baselines/reference/invalidIncremental.symbols b/tests/baselines/reference/invalidIncremental.symbols new file mode 100644 index 00000000000..840f3d76536 --- /dev/null +++ b/tests/baselines/reference/invalidIncremental.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/invalidIncremental.ts === +const x = 10; +>x : Symbol(x, Decl(invalidIncremental.ts, 0, 5)) + + diff --git a/tests/baselines/reference/invalidIncremental.types b/tests/baselines/reference/invalidIncremental.types new file mode 100644 index 00000000000..2035b6fa749 --- /dev/null +++ b/tests/baselines/reference/invalidIncremental.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/invalidIncremental.ts === +const x = 10; +>x : 10 +>10 : 10 + + diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index ec795e83e23..8e4ff517186 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index b931fe1745a..7332496971f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 6a437fd4c14..ebf7070cfa4 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index d1d8d42c433..25f9b39967a 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index c2bcb1307c1..fc1fb8ec631 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 37c1960d80d..dcff85de986 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": ["es5","es2015.promise"], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index ec795e83e23..8e4ff517186 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index bc24243c11f..112be7a95f9 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": ["es5","es2015.core"], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index 1c16ed11416..4c4b740a122 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ @@ -14,7 +15,6 @@ // "outDir": "./", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ - // "incremental": true, /* Enable incremental compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ diff --git a/tests/cases/compiler/invalidIncremental.ts b/tests/cases/compiler/invalidIncremental.ts new file mode 100644 index 00000000000..4a7c3e72de9 --- /dev/null +++ b/tests/cases/compiler/invalidIncremental.ts @@ -0,0 +1,4 @@ +// @incremental: true + +const x = 10; + From 722afc18bbcf7265df98ea35a91e1725ad53a6ce Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 21 Mar 2019 09:01:52 -0700 Subject: [PATCH 05/48] Fix typo --- src/compiler/diagnosticMessages.json | 2 +- src/compiler/program.ts | 2 +- tests/baselines/reference/invalidIncremental.errors.txt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index acc9a437ca1..6638d2c409a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3072,7 +3072,7 @@ "category": "Error", "code": 5073 }, - "Option '--incremental' can only be speicified when using tsconfig.": { + "Option '--incremental' can only be specified when using tsconfig.": { "category": "Error", "code": 5074 }, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2d8c4d5e4c3..b65c8c0431c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2723,7 +2723,7 @@ namespace ts { } if (options.incremental && !options.configFilePath) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_speicified_when_using_tsconfig)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_when_using_tsconfig)); } if (options.composite) { diff --git a/tests/baselines/reference/invalidIncremental.errors.txt b/tests/baselines/reference/invalidIncremental.errors.txt index 6b6382e8f2e..cdd19e67093 100644 --- a/tests/baselines/reference/invalidIncremental.errors.txt +++ b/tests/baselines/reference/invalidIncremental.errors.txt @@ -1,7 +1,7 @@ -error TS5074: Option '--incremental' can only be speicified when using tsconfig. +error TS5074: Option '--incremental' can only be specified when using tsconfig. -!!! error TS5074: Option '--incremental' can only be speicified when using tsconfig. +!!! error TS5074: Option '--incremental' can only be specified when using tsconfig. ==== tests/cases/compiler/invalidIncremental.ts (0 errors) ==== const x = 10; From 35470b3f3bdde41a4d975b84a5f8d40853b05952 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 25 Mar 2019 12:37:55 -0700 Subject: [PATCH 06/48] Make tsbuildInfoFile as commandline option to tsc (and not tsc -b) --- src/compiler/builder.ts | 6 ++-- src/compiler/commandLineParser.ts | 1 - src/compiler/diagnosticMessages.json | 2 +- src/compiler/emitter.ts | 3 +- src/compiler/program.ts | 16 ++++++---- .../unittests/config/commandLineParsing.ts | 29 ++++++++++++++++++- src/tsc/tsc.ts | 29 +++++++------------ .../baselines/reference/incrementalConfig.js | 6 ++++ .../reference/incrementalConfig.symbols | 4 +++ .../reference/incrementalConfig.types | 5 ++++ .../reference/incrementalInvalid.errors.txt | 8 +++++ .../baselines/reference/incrementalInvalid.js | 7 +++++ .../reference/incrementalInvalid.symbols | 5 ++++ .../reference/incrementalInvalid.types | 6 ++++ tests/baselines/reference/incrementalOut.js | 7 +++++ .../reference/incrementalOut.symbols | 5 ++++ .../baselines/reference/incrementalOut.types | 6 ++++ .../reference/invalidIncremental.errors.txt | 8 ----- .../baselines/reference/invalidIncremental.js | 7 ----- .../reference/invalidIncremental.symbols | 5 ---- .../reference/invalidIncremental.types | 6 ---- tests/cases/compiler/incrementalConfig.ts | 8 +++++ ...idIncremental.ts => incrementalInvalid.ts} | 0 tests/cases/compiler/incrementalOut.ts | 5 ++++ 24 files changed, 126 insertions(+), 58 deletions(-) create mode 100644 tests/baselines/reference/incrementalConfig.js create mode 100644 tests/baselines/reference/incrementalConfig.symbols create mode 100644 tests/baselines/reference/incrementalConfig.types create mode 100644 tests/baselines/reference/incrementalInvalid.errors.txt create mode 100644 tests/baselines/reference/incrementalInvalid.js create mode 100644 tests/baselines/reference/incrementalInvalid.symbols create mode 100644 tests/baselines/reference/incrementalInvalid.types create mode 100644 tests/baselines/reference/incrementalOut.js create mode 100644 tests/baselines/reference/incrementalOut.symbols create mode 100644 tests/baselines/reference/incrementalOut.types delete mode 100644 tests/baselines/reference/invalidIncremental.errors.txt delete mode 100644 tests/baselines/reference/invalidIncremental.js delete mode 100644 tests/baselines/reference/invalidIncremental.symbols delete mode 100644 tests/baselines/reference/invalidIncremental.types create mode 100644 tests/cases/compiler/incrementalConfig.ts rename tests/cases/compiler/{invalidIncremental.ts => incrementalInvalid.ts} (100%) create mode 100644 tests/cases/compiler/incrementalOut.ts diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index faf51568241..f72f30b226c 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -792,7 +792,7 @@ namespace ts { state, // When whole program is affected, do emit only once (eg when --out or --outFile is specified) // Otherwise just affected file - affected.emitBuildInfo(writeFile || host.writeFile, cancellationToken), + affected.emitBuildInfo(writeFile || maybeBind(host, host.writeFile), cancellationToken), affected, /*isPendingEmitFile*/ false, /*isBuildInfoEmit*/ true @@ -820,7 +820,7 @@ namespace ts { state, // When whole program is affected, do emit only once (eg when --out or --outFile is specified) // Otherwise just affected file - Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected as SourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), + Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected as SourceFile, writeFile || maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile ); @@ -862,7 +862,7 @@ namespace ts { }; } } - return Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); + return Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers); } /** diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a200ebf67e0..12a20e0df42 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -343,7 +343,6 @@ namespace ts { type: "string", isFilePath: true, paramType: Diagnostics.FILE, - isTSConfigOnly: true, category: Diagnostics.Basic_Options, description: Diagnostics.Specify_file_to_store_incremental_compilation_information, }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6638d2c409a..6cb498df827 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3072,7 +3072,7 @@ "category": "Error", "code": 5073 }, - "Option '--incremental' can only be specified when using tsconfig.": { + "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified.": { "category": "Error", "code": 5074 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index be867db68fb..8f91e3d25c1 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -54,7 +54,7 @@ namespace ts { /*@internal*/ export function getOutputPathForBuildInfo(options: CompilerOptions) { const configFile = options.configFilePath; - if (!configFile || !isIncrementalCompilation(options)) return undefined; + if (!isIncrementalCompilation(options)) return undefined; if (options.tsBuildInfoFile) return options.tsBuildInfoFile; const outPath = options.outFile || options.out; let buildInfoExtensionLess: string; @@ -62,6 +62,7 @@ namespace ts { buildInfoExtensionLess = removeFileExtension(outPath); } else { + if (!configFile) return undefined; const configFileExtensionLess = removeFileExtension(configFile); buildInfoExtensionLess = options.outDir ? options.rootDir ? diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b65c8c0431c..5bace99aa53 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -198,7 +198,8 @@ namespace ts { getDirectories: (path: string) => system.getDirectories(path), realpath, readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth), - createDirectory: d => system.createDirectory(d) + createDirectory: d => system.createDirectory(d), + createHash: maybeBind(system, system.createHash) }; return compilerHost; } @@ -320,7 +321,10 @@ namespace ts { }; } - export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray { + // tslint:disable unified-signatures + export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + /*@internal*/ export function getPreEmitDiagnostics(program: BuilderProgram, sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + export function getPreEmitDiagnostics(program: Program | BuilderProgram, sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray { const diagnostics = [ ...program.getConfigFileParsingDiagnostics(), ...program.getOptionsDiagnostics(cancellationToken), @@ -335,6 +339,7 @@ namespace ts { return sortAndDeduplicateDiagnostics(diagnostics); } + // tslint:enable unified-signatures export interface FormatDiagnosticsHost { getCurrentDirectory(): string; @@ -2722,10 +2727,6 @@ namespace ts { createDiagnosticForOptionName(Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option, "paths"); } - if (options.incremental && !options.configFilePath) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_when_using_tsconfig)); - } - if (options.composite) { if (options.declaration === false) { createDiagnosticForOptionName(Diagnostics.Composite_projects_may_not_disable_declaration_emit, "declaration"); @@ -2740,6 +2741,9 @@ namespace ts { createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite"); } } + else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) { + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)); + } verifyProjectReferences(); diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 33716841b79..ccb2378c644 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -375,6 +375,16 @@ namespace ts { options: { incremental: true } }); }); + + it("parse --tsBuildInfoFile", () => { + // --lib es6 0.ts + assertParseResult(["--tsBuildInfoFile", "build.tsbuildinfo", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { tsBuildInfoFile: "build.tsbuildinfo" } + }); + }); }); describe("unittests:: config:: commandLineParsing:: parseBuildOptions", () => { @@ -466,7 +476,7 @@ namespace ts { }); }); - it("parse build with --incremental ", () => { + it("parse build with --incremental", () => { // --lib es6 0.ts assertParseResult(["--incremental", "tests"], { @@ -476,6 +486,23 @@ namespace ts { }); }); + it("parse build with --tsBuildInfoFile", () => { + // --lib es6 0.ts + assertParseResult(["--tsBuildInfoFile", "build.tsbuildinfo", "tests"], + { + errors: [{ + messageText: "Unknown build option '--tsBuildInfoFile'.", + category: Diagnostics.Unknown_build_option_0.category, + code: Diagnostics.Unknown_build_option_0.code, + file: undefined, + start: undefined, + length: undefined + }], + projects: ["build.tsbuildinfo", "tests"], + buildOptions: { } + }); + }); + describe("Combining options that make no sense together", () => { function verifyInvalidCombination(flag1: keyof BuildOptions, flag2: keyof BuildOptions) { it(`--${flag1} and --${flag2} together is invalid`, () => { diff --git a/src/tsc/tsc.ts b/src/tsc/tsc.ts index 499848fdf92..b8ee7e3c8d1 100644 --- a/src/tsc/tsc.ts +++ b/src/tsc/tsc.ts @@ -165,6 +165,9 @@ namespace ts { reportWatchModeWithoutSysSupport(); createWatchOfFilesAndCompilerOptions(commandLine.fileNames, commandLineOptions); } + else if (isIncrementalCompilation(commandLineOptions)) { + performIncrementalCompilation(commandLine); + } else { performCompilation(commandLine.fileNames, /*references*/ undefined, commandLineOptions); } @@ -265,34 +268,22 @@ namespace ts { const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName)); enableStatistics(options); - const oldProgram = readBuilderProgram(options, path => host.readFile(path)); const configFileParsingDiagnostics = getConfigFileParsingDiagnostics(config); - const programOptions: CreateProgramOptions = { - rootNames: fileNames, - options, - projectReferences, - host, - configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config), - }; - const program = createProgram(programOptions); const builderProgram = createEmitAndSemanticDiagnosticsBuilderProgram( - program, - { - useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, - createHash: maybeBind(sys, sys.createHash), - writeFile: (path, data, writeByteOrderMark) => sys.writeFile(path, data, writeByteOrderMark) - }, - oldProgram, - configFileParsingDiagnostics + fileNames, + options, + host, + readBuilderProgram(options, path => host.readFile(path)), + configFileParsingDiagnostics, + projectReferences ); - const exitStatus = emitFilesAndReportErrors( builderProgram, reportDiagnostic, s => sys.write(s + sys.newLine), createReportErrorSummary(options) ); - reportStatistics(program); + reportStatistics(builderProgram.getProgram()); return sys.exit(exitStatus); } diff --git a/tests/baselines/reference/incrementalConfig.js b/tests/baselines/reference/incrementalConfig.js new file mode 100644 index 00000000000..b90c65b9f09 --- /dev/null +++ b/tests/baselines/reference/incrementalConfig.js @@ -0,0 +1,6 @@ +//// [a.ts] +const x = 10; + + +//// [a.js] +var x = 10; diff --git a/tests/baselines/reference/incrementalConfig.symbols b/tests/baselines/reference/incrementalConfig.symbols new file mode 100644 index 00000000000..05c35bcf58a --- /dev/null +++ b/tests/baselines/reference/incrementalConfig.symbols @@ -0,0 +1,4 @@ +=== /a.ts === +const x = 10; +>x : Symbol(x, Decl(a.ts, 0, 5)) + diff --git a/tests/baselines/reference/incrementalConfig.types b/tests/baselines/reference/incrementalConfig.types new file mode 100644 index 00000000000..ed892fed2ba --- /dev/null +++ b/tests/baselines/reference/incrementalConfig.types @@ -0,0 +1,5 @@ +=== /a.ts === +const x = 10; +>x : 10 +>10 : 10 + diff --git a/tests/baselines/reference/incrementalInvalid.errors.txt b/tests/baselines/reference/incrementalInvalid.errors.txt new file mode 100644 index 00000000000..6c88c5fc9d3 --- /dev/null +++ b/tests/baselines/reference/incrementalInvalid.errors.txt @@ -0,0 +1,8 @@ +error TS5074: Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified. + + +!!! error TS5074: Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified. +==== tests/cases/compiler/incrementalInvalid.ts (0 errors) ==== + const x = 10; + + \ No newline at end of file diff --git a/tests/baselines/reference/incrementalInvalid.js b/tests/baselines/reference/incrementalInvalid.js new file mode 100644 index 00000000000..6ca4b1b2dad --- /dev/null +++ b/tests/baselines/reference/incrementalInvalid.js @@ -0,0 +1,7 @@ +//// [incrementalInvalid.ts] +const x = 10; + + + +//// [incrementalInvalid.js] +var x = 10; diff --git a/tests/baselines/reference/incrementalInvalid.symbols b/tests/baselines/reference/incrementalInvalid.symbols new file mode 100644 index 00000000000..7a75ad5da9d --- /dev/null +++ b/tests/baselines/reference/incrementalInvalid.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/incrementalInvalid.ts === +const x = 10; +>x : Symbol(x, Decl(incrementalInvalid.ts, 0, 5)) + + diff --git a/tests/baselines/reference/incrementalInvalid.types b/tests/baselines/reference/incrementalInvalid.types new file mode 100644 index 00000000000..90e391222dd --- /dev/null +++ b/tests/baselines/reference/incrementalInvalid.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/incrementalInvalid.ts === +const x = 10; +>x : 10 +>10 : 10 + + diff --git a/tests/baselines/reference/incrementalOut.js b/tests/baselines/reference/incrementalOut.js new file mode 100644 index 00000000000..af73fb45a22 --- /dev/null +++ b/tests/baselines/reference/incrementalOut.js @@ -0,0 +1,7 @@ +//// [incrementalOut.ts] +const x = 10; + + + +//// [output.js] +var x = 10; diff --git a/tests/baselines/reference/incrementalOut.symbols b/tests/baselines/reference/incrementalOut.symbols new file mode 100644 index 00000000000..6ad1a4d76ee --- /dev/null +++ b/tests/baselines/reference/incrementalOut.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/incrementalOut.ts === +const x = 10; +>x : Symbol(x, Decl(incrementalOut.ts, 0, 5)) + + diff --git a/tests/baselines/reference/incrementalOut.types b/tests/baselines/reference/incrementalOut.types new file mode 100644 index 00000000000..55b02107adf --- /dev/null +++ b/tests/baselines/reference/incrementalOut.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/incrementalOut.ts === +const x = 10; +>x : 10 +>10 : 10 + + diff --git a/tests/baselines/reference/invalidIncremental.errors.txt b/tests/baselines/reference/invalidIncremental.errors.txt deleted file mode 100644 index cdd19e67093..00000000000 --- a/tests/baselines/reference/invalidIncremental.errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -error TS5074: Option '--incremental' can only be specified when using tsconfig. - - -!!! error TS5074: Option '--incremental' can only be specified when using tsconfig. -==== tests/cases/compiler/invalidIncremental.ts (0 errors) ==== - const x = 10; - - \ No newline at end of file diff --git a/tests/baselines/reference/invalidIncremental.js b/tests/baselines/reference/invalidIncremental.js deleted file mode 100644 index 4798b1d4fa3..00000000000 --- a/tests/baselines/reference/invalidIncremental.js +++ /dev/null @@ -1,7 +0,0 @@ -//// [invalidIncremental.ts] -const x = 10; - - - -//// [invalidIncremental.js] -var x = 10; diff --git a/tests/baselines/reference/invalidIncremental.symbols b/tests/baselines/reference/invalidIncremental.symbols deleted file mode 100644 index 840f3d76536..00000000000 --- a/tests/baselines/reference/invalidIncremental.symbols +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/compiler/invalidIncremental.ts === -const x = 10; ->x : Symbol(x, Decl(invalidIncremental.ts, 0, 5)) - - diff --git a/tests/baselines/reference/invalidIncremental.types b/tests/baselines/reference/invalidIncremental.types deleted file mode 100644 index 2035b6fa749..00000000000 --- a/tests/baselines/reference/invalidIncremental.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/compiler/invalidIncremental.ts === -const x = 10; ->x : 10 ->10 : 10 - - diff --git a/tests/cases/compiler/incrementalConfig.ts b/tests/cases/compiler/incrementalConfig.ts new file mode 100644 index 00000000000..6ed172c837a --- /dev/null +++ b/tests/cases/compiler/incrementalConfig.ts @@ -0,0 +1,8 @@ +// @incremental: true + +// @Filename: /a.ts +const x = 10; + +// @Filename: /tsconfig.json +{ } + diff --git a/tests/cases/compiler/invalidIncremental.ts b/tests/cases/compiler/incrementalInvalid.ts similarity index 100% rename from tests/cases/compiler/invalidIncremental.ts rename to tests/cases/compiler/incrementalInvalid.ts diff --git a/tests/cases/compiler/incrementalOut.ts b/tests/cases/compiler/incrementalOut.ts new file mode 100644 index 00000000000..4cd49dbba11 --- /dev/null +++ b/tests/cases/compiler/incrementalOut.ts @@ -0,0 +1,5 @@ +// @incremental: true +// @out: output.js + +const x = 10; + From 6deb9cdfc717ef6c2176172fb6eacf263c042f0a Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 26 Mar 2019 16:03:06 -0700 Subject: [PATCH 07/48] Add test for incremental with --tsbuildinfo file without specifying --out or config --- tests/baselines/reference/incrementalTsBuildInfoFile.js | 8 ++++++++ .../reference/incrementalTsBuildInfoFile.symbols | 6 ++++++ .../baselines/reference/incrementalTsBuildInfoFile.types | 7 +++++++ tests/cases/compiler/incrementalTsBuildInfoFile.ts | 8 ++++++++ 4 files changed, 29 insertions(+) create mode 100644 tests/baselines/reference/incrementalTsBuildInfoFile.js create mode 100644 tests/baselines/reference/incrementalTsBuildInfoFile.symbols create mode 100644 tests/baselines/reference/incrementalTsBuildInfoFile.types create mode 100644 tests/cases/compiler/incrementalTsBuildInfoFile.ts diff --git a/tests/baselines/reference/incrementalTsBuildInfoFile.js b/tests/baselines/reference/incrementalTsBuildInfoFile.js new file mode 100644 index 00000000000..cdb778d8dd5 --- /dev/null +++ b/tests/baselines/reference/incrementalTsBuildInfoFile.js @@ -0,0 +1,8 @@ +//// [a.ts] +const x = 10; + + + + +//// [a.js] +var x = 10; diff --git a/tests/baselines/reference/incrementalTsBuildInfoFile.symbols b/tests/baselines/reference/incrementalTsBuildInfoFile.symbols new file mode 100644 index 00000000000..d596c6006d7 --- /dev/null +++ b/tests/baselines/reference/incrementalTsBuildInfoFile.symbols @@ -0,0 +1,6 @@ +=== /a.ts === +const x = 10; +>x : Symbol(x, Decl(a.ts, 0, 5)) + + + diff --git a/tests/baselines/reference/incrementalTsBuildInfoFile.types b/tests/baselines/reference/incrementalTsBuildInfoFile.types new file mode 100644 index 00000000000..ab563af0e56 --- /dev/null +++ b/tests/baselines/reference/incrementalTsBuildInfoFile.types @@ -0,0 +1,7 @@ +=== /a.ts === +const x = 10; +>x : 10 +>10 : 10 + + + diff --git a/tests/cases/compiler/incrementalTsBuildInfoFile.ts b/tests/cases/compiler/incrementalTsBuildInfoFile.ts new file mode 100644 index 00000000000..51a9661187c --- /dev/null +++ b/tests/cases/compiler/incrementalTsBuildInfoFile.ts @@ -0,0 +1,8 @@ +// @incremental: true +// @tsBuildInfoFile: /a.tsbuildinfo + + +// @Filename: /a.ts +const x = 10; + + From cf8b3085118bb38540bb8c50032746f2cd244cc2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 29 Mar 2019 14:40:46 -0700 Subject: [PATCH 08/48] Add test for out file concat where command line --incremental flag changes between compilation --- src/testRunner/unittests/tsbuild/outFile.ts | 47 ++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index 53288065658..48beeef4f61 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -197,8 +197,8 @@ namespace ts { dtsUnchangedExpectedReadFilesDependOrdered = undefined!; }); - function createSolutionBuilder(host: fakes.SolutionBuilderHost) { - return ts.createSolutionBuilder(host, ["/src/third"], { dry: false, force: false, verbose: true }); + function createSolutionBuilder(host: fakes.SolutionBuilderHost, baseOptions?: BuildOptions) { + return ts.createSolutionBuilder(host, ["/src/third"], { dry: false, force: false, verbose: true, ...(baseOptions || {}) }); } function getInitialExpectedReadFiles(additionalSourceFiles?: ReadonlyArray) { @@ -446,6 +446,49 @@ namespace ts { ); }); + it("rebuilds completely when command line incremental flag changes between non dts changes", () => { + const fs = outFileFs.shadow(); + // Make non composite third project + replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""); + + // Build with command line incremental + const host = new fakes.SolutionBuilderHost(fs); + const builder = createSolutionBuilder(host, { incremental: true }); + builder.buildAllProjects(); + host.assertDiagnosticMessages(...initialExpectedDiagnostics); + host.clearDiagnostics(); + tick(); + + // Make non incremental build with change in file that doesnt affect dts + appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);"); + builder.resetBuildContext({ verbose: true }); + builder.buildAllProjects(); + host.assertDiagnosticMessages(getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), + [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], + [Diagnostics.Building_project_0, sources[project.first][source.config]], + [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relSources[project.second][source.config], relSources[project.second][source.ts][part.one], relOutputFiles[project.second][ext.js]], + [Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relSources[project.third][source.config], "src/first"], + [Diagnostics.Building_project_0, sources[project.third][source.config]] + ); + host.clearDiagnostics(); + tick(); + + // Make incremental build with change in file that doesnt affect dts + appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);"); + builder.resetBuildContext({ verbose: true, incremental: true }); + builder.buildAllProjects(); + // Builds completely because tsbuildinfo is old. + host.assertDiagnosticMessages( + getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]), + [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]], + [Diagnostics.Building_project_0, sources[project.first][source.config]], + [Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relSources[project.second][source.config], relSources[project.second][source.ts][part.one], relOutputFiles[project.second][ext.js]], + [Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.third][source.config], relOutputFiles[project.third][ext.buildinfo], "src/first"], + [Diagnostics.Building_project_0, sources[project.third][source.config]] + ); + host.clearDiagnostics(); + }); + describe("Prepend output with .tsbuildinfo", () => { // Prologues describe("Prologues", () => { From 9a3149b9673d0d9cdb72d44553eeaf339d6fd7dc Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 13:33:41 -0700 Subject: [PATCH 09/48] Add failing tests for destructuring void --- tests/cases/conformance/es6/destructuring/destructuringVoid.ts | 3 +++ .../es6/destructuring/destructuringVoidStrictNullChecks.ts | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 tests/cases/conformance/es6/destructuring/destructuringVoid.ts create mode 100644 tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts diff --git a/tests/cases/conformance/es6/destructuring/destructuringVoid.ts b/tests/cases/conformance/es6/destructuring/destructuringVoid.ts new file mode 100644 index 00000000000..b4e507ac906 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringVoid.ts @@ -0,0 +1,3 @@ +// @strictNullChecks: false +declare const v: void; +const {} = v; diff --git a/tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts b/tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts new file mode 100644 index 00000000000..09ce95b2b30 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts @@ -0,0 +1,3 @@ +// @strictNullChecks: true +declare const v: void; +const {} = v; From b4ec2e4f505317998dc31748afde2a6347261b58 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 13:34:27 -0700 Subject: [PATCH 10/48] Handle destructuring zero elements from void --- src/compiler/checker.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index febb8ffdad3..1f6e8830ade 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19518,6 +19518,21 @@ namespace ts { return type; } + function checkNonNullNonVoidType( + type: Type, + node: Node, + nullDiagnostic?: DiagnosticMessage, + undefinedDiagnostic?: DiagnosticMessage, + nullOrUndefinedDiagnostic?: DiagnosticMessage, + voidDiagnostic?: DiagnosticMessage + ): Type { + const nonNullType = checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic); + if (nonNullType !== errorType && nonNullType.flags & TypeFlags.Void) { + error(node, voidDiagnostic || Diagnostics.Object_is_possibly_undefined); + } + return nonNullType; + } + function checkPropertyAccessExpression(node: PropertyAccessExpression) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -26258,7 +26273,7 @@ namespace ts { if (node.initializer && node.parent.parent.kind !== SyntaxKind.ForInStatement) { const initializerType = checkExpressionCached(node.initializer); if (strictNullChecks && node.name.elements.length === 0) { - checkNonNullType(initializerType, node); + checkNonNullNonVoidType(initializerType, node); } else { checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer); From ae391497b0d22809fa151802c729c0304f68dfea Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 13:36:07 -0700 Subject: [PATCH 11/48] Add new baselines for destructuring void --- tests/baselines/reference/destructuringVoid.js | 7 +++++++ tests/baselines/reference/destructuringVoid.symbols | 7 +++++++ tests/baselines/reference/destructuringVoid.types | 7 +++++++ .../destructuringVoidStrictNullChecks.errors.txt | 9 +++++++++ .../reference/destructuringVoidStrictNullChecks.js | 7 +++++++ .../reference/destructuringVoidStrictNullChecks.symbols | 7 +++++++ .../reference/destructuringVoidStrictNullChecks.types | 7 +++++++ 7 files changed, 51 insertions(+) create mode 100644 tests/baselines/reference/destructuringVoid.js create mode 100644 tests/baselines/reference/destructuringVoid.symbols create mode 100644 tests/baselines/reference/destructuringVoid.types create mode 100644 tests/baselines/reference/destructuringVoidStrictNullChecks.errors.txt create mode 100644 tests/baselines/reference/destructuringVoidStrictNullChecks.js create mode 100644 tests/baselines/reference/destructuringVoidStrictNullChecks.symbols create mode 100644 tests/baselines/reference/destructuringVoidStrictNullChecks.types diff --git a/tests/baselines/reference/destructuringVoid.js b/tests/baselines/reference/destructuringVoid.js new file mode 100644 index 00000000000..d8a36637389 --- /dev/null +++ b/tests/baselines/reference/destructuringVoid.js @@ -0,0 +1,7 @@ +//// [destructuringVoid.ts] +declare const v: void; +const {} = v; + + +//// [destructuringVoid.js] +var _a = v; diff --git a/tests/baselines/reference/destructuringVoid.symbols b/tests/baselines/reference/destructuringVoid.symbols new file mode 100644 index 00000000000..1c2a78738cb --- /dev/null +++ b/tests/baselines/reference/destructuringVoid.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/destructuring/destructuringVoid.ts === +declare const v: void; +>v : Symbol(v, Decl(destructuringVoid.ts, 0, 13)) + +const {} = v; +>v : Symbol(v, Decl(destructuringVoid.ts, 0, 13)) + diff --git a/tests/baselines/reference/destructuringVoid.types b/tests/baselines/reference/destructuringVoid.types new file mode 100644 index 00000000000..dfa8dd473ff --- /dev/null +++ b/tests/baselines/reference/destructuringVoid.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/destructuring/destructuringVoid.ts === +declare const v: void; +>v : void + +const {} = v; +>v : void + diff --git a/tests/baselines/reference/destructuringVoidStrictNullChecks.errors.txt b/tests/baselines/reference/destructuringVoidStrictNullChecks.errors.txt new file mode 100644 index 00000000000..d20c68348f3 --- /dev/null +++ b/tests/baselines/reference/destructuringVoidStrictNullChecks.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts(2,7): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts (1 errors) ==== + declare const v: void; + const {} = v; + ~~ +!!! error TS2532: Object is possibly 'undefined'. + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringVoidStrictNullChecks.js b/tests/baselines/reference/destructuringVoidStrictNullChecks.js new file mode 100644 index 00000000000..418fb5fc8e2 --- /dev/null +++ b/tests/baselines/reference/destructuringVoidStrictNullChecks.js @@ -0,0 +1,7 @@ +//// [destructuringVoidStrictNullChecks.ts] +declare const v: void; +const {} = v; + + +//// [destructuringVoidStrictNullChecks.js] +var _a = v; diff --git a/tests/baselines/reference/destructuringVoidStrictNullChecks.symbols b/tests/baselines/reference/destructuringVoidStrictNullChecks.symbols new file mode 100644 index 00000000000..9f923453a9e --- /dev/null +++ b/tests/baselines/reference/destructuringVoidStrictNullChecks.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts === +declare const v: void; +>v : Symbol(v, Decl(destructuringVoidStrictNullChecks.ts, 0, 13)) + +const {} = v; +>v : Symbol(v, Decl(destructuringVoidStrictNullChecks.ts, 0, 13)) + diff --git a/tests/baselines/reference/destructuringVoidStrictNullChecks.types b/tests/baselines/reference/destructuringVoidStrictNullChecks.types new file mode 100644 index 00000000000..df6e6af3e4f --- /dev/null +++ b/tests/baselines/reference/destructuringVoidStrictNullChecks.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/es6/destructuring/destructuringVoidStrictNullChecks.ts === +declare const v: void; +>v : void + +const {} = v; +>v : void + From f383c3c42dbb47b87d92bfae88c5a9b7ffd7eb1b Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 14:11:30 -0700 Subject: [PATCH 12/48] Add test for parenthesized variable and function keyword within ternary --- .../parserParenthesizedVariableAndFunctionInTernary.ts | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/cases/conformance/parser/ecmascript5/parserParenthesizedVariableAndFunctionInTernary.ts diff --git a/tests/cases/conformance/parser/ecmascript5/parserParenthesizedVariableAndFunctionInTernary.ts b/tests/cases/conformance/parser/ecmascript5/parserParenthesizedVariableAndFunctionInTernary.ts new file mode 100644 index 00000000000..c2bca11d934 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/parserParenthesizedVariableAndFunctionInTernary.ts @@ -0,0 +1,2 @@ +let a: any; +const c = true ? (a) : function() {}; From abd448fe62fab858859537b60b5f4e578a3b3415 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 14:14:19 -0700 Subject: [PATCH 13/48] Remove unused arguments --- src/compiler/checker.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1f6e8830ade..93e66dd05e4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19518,17 +19518,10 @@ namespace ts { return type; } - function checkNonNullNonVoidType( - type: Type, - node: Node, - nullDiagnostic?: DiagnosticMessage, - undefinedDiagnostic?: DiagnosticMessage, - nullOrUndefinedDiagnostic?: DiagnosticMessage, - voidDiagnostic?: DiagnosticMessage - ): Type { - const nonNullType = checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic); + function checkNonNullNonVoidType(type: Type, node: Node): Type { + const nonNullType = checkNonNullType(type, node); if (nonNullType !== errorType && nonNullType.flags & TypeFlags.Void) { - error(node, voidDiagnostic || Diagnostics.Object_is_possibly_undefined); + error(node, Diagnostics.Object_is_possibly_undefined); } return nonNullType; } From 0830292633790a6a50a494589ac0efd0f500b59c Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 2 Apr 2019 09:38:52 -0700 Subject: [PATCH 14/48] Update user baselines (#30703) --- tests/baselines/reference/user/npm.log | 10 +--------- tests/baselines/reference/user/prettier.log | 8 ++------ tests/baselines/reference/user/uglify-js.log | 6 +++--- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/baselines/reference/user/npm.log b/tests/baselines/reference/user/npm.log index d8b2b47141a..8b6ed846143 100644 --- a/tests/baselines/reference/user/npm.log +++ b/tests/baselines/reference/user/npm.log @@ -623,8 +623,6 @@ node_modules/npm/lib/pack.js(177,25): error TS2339: Property 'config' does not e node_modules/npm/lib/pack.js(299,17): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/pack.js(300,20): error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'. node_modules/npm/lib/pack.js(300,36): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. -node_modules/npm/lib/pack.js(320,7): error TS2531: Object is possibly 'null'. -node_modules/npm/lib/pack.js(325,7): error TS2531: Object is possibly 'null'. node_modules/npm/lib/pack.js(333,15): error TS2531: Object is possibly 'null'. node_modules/npm/lib/pack.js(335,17): error TS2339: Property 'code' does not exist on type 'Error'. node_modules/npm/lib/pack.js(336,17): error TS2339: Property 'signal' does not exist on type 'Error'. @@ -828,7 +826,7 @@ node_modules/npm/lib/utils/locker.js(28,20): error TS2339: Property 'config' doe node_modules/npm/lib/utils/locker.js(29,17): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/utils/locker.js(65,15): error TS2339: Property 'code' does not exist on type 'Error'. node_modules/npm/lib/utils/map-to-registry.js(98,45): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. -node_modules/npm/lib/utils/metrics-launch.js(6,5): error TS2367: This condition will always return 'false' since the types 'NodeModule | undefined' and '{ "../../../tests/cases/user/npm/node_modules/npm/lib/utils/metrics-launch": () => ChildProcess | undefined; }' have no overlap. +node_modules/npm/lib/utils/metrics-launch.js(6,5): error TS2367: This condition will always return 'false' since the types 'NodeModule | undefined' and '{ "../../../tests/cases/user/npm/node_modules/npm/lib/utils/metrics-launch": () => ChildProcessWithoutNullStreams | undefined; }' have no overlap. node_modules/npm/lib/utils/metrics-launch.js(12,14): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/utils/metrics-launch.js(13,36): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/utils/metrics-launch.js(14,30): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. @@ -946,9 +944,6 @@ node_modules/npm/test/need-npm5-update/legacy-optional-deps.js(12,21): error TS2 node_modules/npm/test/need-npm5-update/legacy-shrinkwrap.js(2,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/need-npm5-update/legacy-shrinkwrap.js(6,21): error TS2307: Cannot find module 'tacks'. node_modules/npm/test/need-npm5-update/lifecycle-signal.js(8,20): error TS2307: Cannot find module 'tap'. -node_modules/npm/test/need-npm5-update/lifecycle-signal.js(70,3): error TS2531: Object is possibly 'null'. -node_modules/npm/test/need-npm5-update/lifecycle-signal.js(95,3): error TS2531: Object is possibly 'null'. -node_modules/npm/test/need-npm5-update/lifecycle-signal.js(117,3): error TS2531: Object is possibly 'null'. node_modules/npm/test/need-npm5-update/move-no-clobber-dest-node-modules.js(3,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/need-npm5-update/move-no-clobber-dest-node-modules.js(11,48): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'string[]'. node_modules/npm/test/need-npm5-update/need-only-update-save-optional/update-save.js(5,18): error TS2307: Cannot find module 'npm-registry-mock'. @@ -1717,7 +1712,6 @@ node_modules/npm/test/tap/version-from-git.js(202,7): error TS2339: Property 'lo node_modules/npm/test/tap/version-from-git.js(213,7): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/version-git-not-clean.js(2,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/version-git-not-clean.js(17,7): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'. -node_modules/npm/test/tap/version-git-not-clean.js(28,13): error TS2531: Object is possibly 'null'. node_modules/npm/test/tap/version-git-not-clean.js(42,17): error TS2339: Property 'commands' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/version-lifecycle.js(7,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/version-lifecycle.js(28,7): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'. @@ -1732,8 +1726,6 @@ node_modules/npm/test/tap/version-no-git.js(17,7): error TS2339: Property 'load' node_modules/npm/test/tap/version-no-package.js(2,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/version-no-tags.js(2,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/version-no-tags.js(17,7): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'. -node_modules/npm/test/tap/version-no-tags.js(23,9): error TS2531: Object is possibly 'null'. -node_modules/npm/test/tap/version-no-tags.js(32,7): error TS2531: Object is possibly 'null'. node_modules/npm/test/tap/version-no-tags.js(34,13): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/version-no-tags.js(35,13): error TS2339: Property 'commands' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/version-sub-directory-shrinkwrap.js(8,20): error TS2307: Cannot find module 'tap'. diff --git a/tests/baselines/reference/user/prettier.log b/tests/baselines/reference/user/prettier.log index 45989ee91da..c5c4fe2b126 100644 --- a/tests/baselines/reference/user/prettier.log +++ b/tests/baselines/reference/user/prettier.log @@ -10,12 +10,8 @@ src/cli/util.js(454,16): error TS2339: Property 'type' does not exist on type 'n src/cli/util.js(455,16): error TS2339: Property 'oppositeDescription' does not exist on type 'never'. src/cli/util.js(456,17): error TS2339: Property 'name' does not exist on type 'never'. src/common/parser-create-error.js(8,9): error TS2339: Property 'loc' does not exist on type 'SyntaxError'. -src/config/resolve-config-editorconfig.js(20,36): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("../../../node_modules/mem/index")' has no compatible call signatures. -src/config/resolve-config-editorconfig.js(27,35): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("../../../node_modules/mem/index")' has no compatible call signatures. -src/config/resolve-config-editorconfig.js(42,7): error TS2339: Property 'clear' does not exist on type 'typeof import("../../../node_modules/mem/index")'. -src/config/resolve-config-editorconfig.js(43,7): error TS2339: Property 'clear' does not exist on type 'typeof import("../../../node_modules/mem/index")'. -src/config/resolve-config.js(10,29): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("../../../node_modules/mem/index")' has no compatible call signatures. -src/config/resolve-config.js(70,7): error TS2339: Property 'clear' does not exist on type 'typeof import("../../../node_modules/mem/index")'. +src/config/resolve-config.js(12,11): error TS2571: Object is of type 'unknown'. +src/config/resolve-config.js(13,12): error TS2571: Object is of type 'unknown'. src/config/resolve-config.js(75,32): error TS2345: Argument of type '{ sync: false; }' is not assignable to parameter of type '{ cache: boolean; sync: boolean; }'. Property 'cache' is missing in type '{ sync: false; }' but required in type '{ cache: boolean; sync: boolean; }'. src/config/resolve-config.js(82,32): error TS2345: Argument of type '{ sync: true; }' is not assignable to parameter of type '{ cache: boolean; sync: boolean; }'. diff --git a/tests/baselines/reference/user/uglify-js.log b/tests/baselines/reference/user/uglify-js.log index 4bb7680cd76..ce68e2383ed 100644 --- a/tests/baselines/reference/user/uglify-js.log +++ b/tests/baselines/reference/user/uglify-js.log @@ -104,9 +104,9 @@ node_modules/uglify-js/lib/propmangle.js(146,29): error TS2554: Expected 0 argum node_modules/uglify-js/lib/scope.js(104,29): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/scope.js(159,29): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/scope.js(194,47): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/scope.js(409,29): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/scope.js(466,30): error TS2554: Expected 0 arguments, but got 1. -node_modules/uglify-js/lib/scope.js(491,30): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/scope.js(405,29): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/scope.js(462,30): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/scope.js(487,30): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/sourcemap.js(55,25): error TS2304: Cannot find name 'MOZ_SourceMap'. node_modules/uglify-js/lib/sourcemap.js(61,23): error TS2304: Cannot find name 'MOZ_SourceMap'. node_modules/uglify-js/tools/exit.js(7,32): error TS2339: Property 'bufferSize' does not exist on type 'WriteStream'. From d198c5906fd2049982133e8fa542b146ca1f253e Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 2 Apr 2019 10:58:11 -0700 Subject: [PATCH 15/48] Be stricter while parsing arrow function heads in conditional expressions --- src/compiler/parser.ts | 6 ++++-- src/compiler/types.ts | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 03d0f166b81..7193e9083e6 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3695,7 +3695,7 @@ namespace ts { // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation. // // So we need just a bit of lookahead to ensure that it can only be a signature. - if (!allowAmbiguity && token() !== SyntaxKind.EqualsGreaterThanToken && token() !== SyntaxKind.OpenBraceToken) { + if (!allowAmbiguity && token() !== SyntaxKind.EqualsGreaterThanToken && (contextFlags & NodeFlags.InConditionalWhenTrue || token() !== SyntaxKind.OpenBraceToken)) { // Returning undefined here will cause our caller to rewind to where we started from. return undefined; } @@ -3747,7 +3747,9 @@ namespace ts { const node = createNode(SyntaxKind.ConditionalExpression, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; - node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); + node.whenTrue = doInsideOfContext( + NodeFlags.InConditionalWhenTrue, + () => doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher)); node.colonToken = parseExpectedToken(SyntaxKind.ColonToken); node.whenFalse = nodeIsPresent(node.colonToken) ? parseAssignmentExpressionOrHigher() diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bcc3218a017..e24f3cbc695 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -553,6 +553,7 @@ namespace ts { /* @internal */ Ambient = 1 << 22, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. /* @internal */ InWithStatement = 1 << 23, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) JsonFile = 1 << 24, // If node was parsed in a Json + /* @internal */ InConditionalWhenTrue = 1 << 25, // If node was parsed in the true side of a ConditionalExpression BlockScoped = Let | Const, From 96990800e3f4548ce7b96752b04a0665cb1e0949 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 14:13:09 -0700 Subject: [PATCH 16/48] Add new baselines --- ...arserParenthesizedVariableAndFunctionInTernary.js | 8 ++++++++ ...ParenthesizedVariableAndFunctionInTernary.symbols | 8 ++++++++ ...erParenthesizedVariableAndFunctionInTernary.types | 12 ++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.js create mode 100644 tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.symbols create mode 100644 tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.types diff --git a/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.js b/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.js new file mode 100644 index 00000000000..dde6826c59c --- /dev/null +++ b/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.js @@ -0,0 +1,8 @@ +//// [parserParenthesizedVariableAndFunctionInTernary.ts] +let a: any; +const c = true ? (a) : function() {}; + + +//// [parserParenthesizedVariableAndFunctionInTernary.js] +var a; +var c = true ? (a) : function () { }; diff --git a/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.symbols b/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.symbols new file mode 100644 index 00000000000..3b64c950750 --- /dev/null +++ b/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript5/parserParenthesizedVariableAndFunctionInTernary.ts === +let a: any; +>a : Symbol(a, Decl(parserParenthesizedVariableAndFunctionInTernary.ts, 0, 3)) + +const c = true ? (a) : function() {}; +>c : Symbol(c, Decl(parserParenthesizedVariableAndFunctionInTernary.ts, 1, 5)) +>a : Symbol(a, Decl(parserParenthesizedVariableAndFunctionInTernary.ts, 0, 3)) + diff --git a/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.types b/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.types new file mode 100644 index 00000000000..d3cd1f4fbb6 --- /dev/null +++ b/tests/baselines/reference/parserParenthesizedVariableAndFunctionInTernary.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/parser/ecmascript5/parserParenthesizedVariableAndFunctionInTernary.ts === +let a: any; +>a : any + +const c = true ? (a) : function() {}; +>c : any +>true ? (a) : function() {} : any +>true : true +>(a) : any +>a : any +>function() {} : () => void + From 96660f6c00bab6b3aa8384888644c4811dd9d314 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 2 Apr 2019 11:31:05 -0700 Subject: [PATCH 17/48] Just look at the current node instead of context --- src/compiler/parser.ts | 8 ++++---- src/compiler/types.ts | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7193e9083e6..dd06d98cdbc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3693,9 +3693,11 @@ namespace ts { // - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value. // - "(x,y)" is a comma expression parsed as a signature with two parameters. // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation. + // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type. // // So we need just a bit of lookahead to ensure that it can only be a signature. - if (!allowAmbiguity && token() !== SyntaxKind.EqualsGreaterThanToken && (contextFlags & NodeFlags.InConditionalWhenTrue || token() !== SyntaxKind.OpenBraceToken)) { + const hasJSDocFunctionType = node.type && isJSDocFunctionType(node.type); + if (!allowAmbiguity && token() !== SyntaxKind.EqualsGreaterThanToken && (hasJSDocFunctionType || token() !== SyntaxKind.OpenBraceToken)) { // Returning undefined here will cause our caller to rewind to where we started from. return undefined; } @@ -3747,9 +3749,7 @@ namespace ts { const node = createNode(SyntaxKind.ConditionalExpression, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; - node.whenTrue = doInsideOfContext( - NodeFlags.InConditionalWhenTrue, - () => doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher)); + node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); node.colonToken = parseExpectedToken(SyntaxKind.ColonToken); node.whenFalse = nodeIsPresent(node.colonToken) ? parseAssignmentExpressionOrHigher() diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e24f3cbc695..bcc3218a017 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -553,7 +553,6 @@ namespace ts { /* @internal */ Ambient = 1 << 22, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. /* @internal */ InWithStatement = 1 << 23, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) JsonFile = 1 << 24, // If node was parsed in a Json - /* @internal */ InConditionalWhenTrue = 1 << 25, // If node was parsed in the true side of a ConditionalExpression BlockScoped = Let | Const, From bf0dd79e4acb03ec30f742f13c02c3a6bb868674 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 2 Apr 2019 12:49:39 -0700 Subject: [PATCH 18/48] Update user test submodules (#30705) --- .../cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter | 2 +- .../TypeScript-React-Native-Starter | 2 +- .../user/TypeScript-React-Starter/TypeScript-React-Starter | 2 +- tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter | 2 +- tests/cases/user/axios-src/axios-src | 2 +- tests/cases/user/create-react-app/create-react-app | 2 +- tests/cases/user/prettier/prettier | 2 +- tests/cases/user/puppeteer/puppeteer | 2 +- tests/cases/user/webpack/webpack | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter index 40bdb4eadab..46971a84547 160000 --- a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +++ b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter @@ -1 +1 @@ -Subproject commit 40bdb4eadabc9fbed7d83e3f26817a931c0763b6 +Subproject commit 46971a8454761f1a11d8fde4d96ff8d29bc4e754 diff --git a/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter b/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter index 59571c0d34a..ef797268ddf 160000 --- a/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter +++ b/tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter @@ -1 +1 @@ -Subproject commit 59571c0d34aa48820309291b966778795d1cbebf +Subproject commit ef797268ddfe9b2e5d2273b953eebdbffb4f734c diff --git a/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter b/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter index 68f60e1a4b9..14043775970 160000 --- a/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter +++ b/tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter @@ -1 +1 @@ -Subproject commit 68f60e1a4b947df47418e1d420acc59dafdfef12 +Subproject commit 1404377597038d22c9df43b49ced70bae635edba diff --git a/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter b/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter index 713c6986f04..c243b11a6f8 160000 --- a/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter +++ b/tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter @@ -1 +1 @@ -Subproject commit 713c6986f043f2c31976b8bc2c03aa0a2b05590b +Subproject commit c243b11a6f827e780a5163999bc472c95ff5a0e0 diff --git a/tests/cases/user/axios-src/axios-src b/tests/cases/user/axios-src/axios-src index 0b3db5d87a6..283d7b306ce 160000 --- a/tests/cases/user/axios-src/axios-src +++ b/tests/cases/user/axios-src/axios-src @@ -1 +1 @@ -Subproject commit 0b3db5d87a60a1ad8b0dce9669dbc10483ec33da +Subproject commit 283d7b306ce231f092d28e01713905e5c1600d14 diff --git a/tests/cases/user/create-react-app/create-react-app b/tests/cases/user/create-react-app/create-react-app index 1d4fdc2dd49..1a61db58d43 160000 --- a/tests/cases/user/create-react-app/create-react-app +++ b/tests/cases/user/create-react-app/create-react-app @@ -1 +1 @@ -Subproject commit 1d4fdc2dd4950011beacf1883900bf5d8da7079e +Subproject commit 1a61db58d434d33603f20e73ca643ec83c561b73 diff --git a/tests/cases/user/prettier/prettier b/tests/cases/user/prettier/prettier index 67f1c4877ee..1e471a00796 160000 --- a/tests/cases/user/prettier/prettier +++ b/tests/cases/user/prettier/prettier @@ -1 +1 @@ -Subproject commit 67f1c4877ee1090b66d468a847caccca411a6f82 +Subproject commit 1e471a007968b7490563b91ed6909ae6046f3fe8 diff --git a/tests/cases/user/puppeteer/puppeteer b/tests/cases/user/puppeteer/puppeteer index 98bb2615adb..2c6df6ddd1a 160000 --- a/tests/cases/user/puppeteer/puppeteer +++ b/tests/cases/user/puppeteer/puppeteer @@ -1 +1 @@ -Subproject commit 98bb2615adb6815c91efcc59593b49e2ec8c3935 +Subproject commit 2c6df6ddd1aeb39b6858a1b7c980fe20079230da diff --git a/tests/cases/user/webpack/webpack b/tests/cases/user/webpack/webpack index 10282ea2064..dc266887316 160000 --- a/tests/cases/user/webpack/webpack +++ b/tests/cases/user/webpack/webpack @@ -1 +1 @@ -Subproject commit 10282ea20648b465caec6448849f24fc34e1ba3e +Subproject commit dc2668873162ff3369eb8787c1b79f909650e040 From ca98a50574f67d179ee28857b564a086a8f29197 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 2 Apr 2019 13:04:51 -0700 Subject: [PATCH 19/48] Use const contexts and tuple mapped types to simplify some explicitly elucidated types (#30654) * Use const contexts and tuple mapped types to simplify some explicitly elucidated types * Fix lint * Further cleanup - refactor mapped type into its own alias for readability * Slightly more cleanup - PragmaPsuedoMap neednt be partial, thus removing tons of nonull assertions * Remove GH#18217 comments --- src/compiler/parser.ts | 31 +++++++++++++-------------- src/compiler/types.ts | 48 ++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 03d0f166b81..265099bd6e7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7749,17 +7749,17 @@ namespace ts { context.pragmas = createMap() as PragmaMap; for (const pragma of pragmas) { - if (context.pragmas.has(pragma!.name)) { // TODO: GH#18217 - const currentValue = context.pragmas.get(pragma!.name); + if (context.pragmas.has(pragma.name)) { + const currentValue = context.pragmas.get(pragma.name); if (currentValue instanceof Array) { - currentValue.push(pragma!.args); + currentValue.push(pragma.args); } else { - context.pragmas.set(pragma!.name, [currentValue, pragma!.args]); + context.pragmas.set(pragma.name, [currentValue, pragma.args]); } continue; } - context.pragmas.set(pragma!.name, pragma!.args); + context.pragmas.set(pragma.name, pragma.args); } } @@ -7783,9 +7783,8 @@ namespace ts { const typeReferenceDirectives = context.typeReferenceDirectives; const libReferenceDirectives = context.libReferenceDirectives; forEach(toArray(entryOrList), (arg: PragmaPseudoMap["reference"]) => { - // TODO: GH#18217 - const { types, lib, path } = arg!.arguments; - if (arg!.arguments["no-default-lib"]) { + const { types, lib, path } = arg.arguments; + if (arg.arguments["no-default-lib"]) { context.hasNoDefaultLib = true; } else if (types) { @@ -7798,7 +7797,7 @@ namespace ts { referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value }); } else { - reportDiagnostic(arg!.range.pos, arg!.range.end - arg!.range.pos, Diagnostics.Invalid_reference_directive_syntax); + reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, Diagnostics.Invalid_reference_directive_syntax); } }); break; @@ -7806,7 +7805,7 @@ namespace ts { case "amd-dependency": { context.amdDependencies = map( toArray(entryOrList), - (x: PragmaPseudoMap["amd-dependency"]) => ({ name: x!.arguments.name!, path: x!.arguments.path })); // TODO: GH#18217 + (x: PragmaPseudoMap["amd-dependency"]) => ({ name: x.arguments.name, path: x.arguments.path })); break; } case "amd-module": { @@ -7814,13 +7813,13 @@ namespace ts { for (const entry of entryOrList) { if (context.moduleName) { // TODO: It's probably fine to issue this diagnostic on all instances of the pragma - reportDiagnostic(entry!.range.pos, entry!.range.end - entry!.range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments); + reportDiagnostic(entry.range.pos, entry.range.end - entry.range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments); } - context.moduleName = (entry as PragmaPseudoMap["amd-module"])!.arguments.name; + context.moduleName = (entry as PragmaPseudoMap["amd-module"]).arguments.name; } } else { - context.moduleName = (entryOrList as PragmaPseudoMap["amd-module"])!.arguments.name; + context.moduleName = (entryOrList as PragmaPseudoMap["amd-module"]).arguments.name; } break; } @@ -7828,11 +7827,11 @@ namespace ts { case "ts-check": { // _last_ of either nocheck or check in a file is the "winner" forEach(toArray(entryOrList), entry => { - if (!context.checkJsDirective || entry!.range.pos > context.checkJsDirective.pos) { // TODO: GH#18217 + if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { context.checkJsDirective = { enabled: key === "ts-check", - end: entry!.range.end, - pos: entry!.range.pos + end: entry.range.end, + pos: entry.range.pos }; } }); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bcc3218a017..55492081050 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5950,26 +5950,18 @@ namespace ts { /* @internal */ export interface PragmaDefinition { args?: - | [PragmaArgumentSpecification] - | [PragmaArgumentSpecification, PragmaArgumentSpecification] - | [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification] - | [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification]; + | readonly [PragmaArgumentSpecification] + | readonly [PragmaArgumentSpecification, PragmaArgumentSpecification] + | readonly [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification] + | readonly [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification]; // If not present, defaults to PragmaKindFlags.Default kind?: PragmaKindFlags; } - /** - * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas` - */ - /* @internal */ - function _contextuallyTypePragmas}, K1 extends string, K2 extends string, K3 extends string, K4 extends string>(args: T): T { - return args; - } - // While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't // fancy effectively defining it twice, once in value-space and once in type-space /* @internal */ - export const commentPragmas = _contextuallyTypePragmas({ + export const commentPragmas = { "reference": { args: [ { name: "types", optional: true, captureSpan: true }, @@ -5997,7 +5989,7 @@ namespace ts { args: [{ name: "factory" }], kind: PragmaKindFlags.MultiLine }, - }); + } as const; /* @internal */ type PragmaArgTypeMaybeCapture = TDesc extends {captureSpan: true} ? {value: string, pos: number, end: number} : string; @@ -6008,29 +6000,29 @@ namespace ts { ? {[K in TName]?: PragmaArgTypeMaybeCapture} : {[K in TName]: PragmaArgTypeMaybeCapture}; + /* @internal */ + type UnionToIntersection = + (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; + + /* @internal */ + type ArgumentDefinitionToFieldUnion[]> = { + [K in keyof T]: PragmaArgTypeOptional + }[Extract]; // The mapped type maps over only the tuple members, but this reindex gets _all_ members - by extracting only `number` keys, we get only the tuple members + /** * Maps a pragma definition into the desired shape for its arguments object - * Maybe the below is a good argument for types being iterable on struture in some way. */ /* @internal */ - type PragmaArgumentType = - T extends { args: [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification] } - ? PragmaArgTypeOptional & PragmaArgTypeOptional & PragmaArgTypeOptional & PragmaArgTypeOptional - : T extends { args: [PragmaArgumentSpecification, PragmaArgumentSpecification, PragmaArgumentSpecification] } - ? PragmaArgTypeOptional & PragmaArgTypeOptional & PragmaArgTypeOptional - : T extends { args: [PragmaArgumentSpecification, PragmaArgumentSpecification] } - ? PragmaArgTypeOptional & PragmaArgTypeOptional - : T extends { args: [PragmaArgumentSpecification] } - ? PragmaArgTypeOptional - : object; - // The above fallback to `object` when there's no args to allow `{}` (as intended), but not the number 2, for example - // TODO: Swap to `undefined` for a cleaner API once strictNullChecks is enabled + type PragmaArgumentType = + ConcretePragmaSpecs[KPrag] extends { args: readonly PragmaArgumentSpecification[] } + ? UnionToIntersection> + : never; /* @internal */ type ConcretePragmaSpecs = typeof commentPragmas; /* @internal */ - export type PragmaPseudoMap = {[K in keyof ConcretePragmaSpecs]?: {arguments: PragmaArgumentType, range: CommentRange}}; + export type PragmaPseudoMap = {[K in keyof ConcretePragmaSpecs]: {arguments: PragmaArgumentType, range: CommentRange}}; /* @internal */ export type PragmaPseudoMapEntry = {[K in keyof PragmaPseudoMap]: {name: K, args: PragmaPseudoMap[K]}}[keyof PragmaPseudoMap]; From 3fdd66bddf8174a443f11c4bad1cf19e76c08b34 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 2 Apr 2019 13:15:02 -0700 Subject: [PATCH 20/48] Report program's source files even when there are errors when building using --build mode --- src/compiler/tsbuild.ts | 35 +++++++++++++------ src/compiler/watch.ts | 15 ++++---- src/testRunner/unittests/tsbuild/sample.ts | 6 ++-- .../unittests/tsbuild/transitiveReferences.ts | 2 ++ 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 16e6e42272e..f60641fe0cf 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -394,7 +394,7 @@ namespace ts { const projectStatus = createFileMap(toPath); const missingRoots = createMap(); let globalDependencyGraph: DependencyGraph | undefined; - const writeFileName = (s: string) => host.trace && host.trace(s); + const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined; let readFileWithCache = (f: string) => host.readFile(f); let projectCompilerOptions = baseCompilerOptions; const compilerHost = createCompilerHostFromProgramHost(host, () => projectCompilerOptions); @@ -1129,7 +1129,7 @@ namespace ts { let declDiagnostics: Diagnostic[] | undefined; const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d); const outputFiles: OutputFile[] = []; - emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark })); + emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark })); // Don't emit .d.ts if there are decl file errors if (declDiagnostics) { program.restoreState(); @@ -1138,7 +1138,7 @@ namespace ts { // Actual Emit const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createFileMap(toPath as ToPath); + const emittedOutputs = createFileMap(toPath as ToPath); outputFiles.forEach(({ name, text, writeByteOrderMark }) => { let priorChangeTime: Date | undefined; if (!anyDtsChanged && isDeclarationFile(name)) { @@ -1152,7 +1152,7 @@ namespace ts { } } - emittedOutputs.setValue(name, true); + emittedOutputs.setValue(name, name); writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); if (priorChangeTime !== undefined) { newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); @@ -1165,6 +1165,11 @@ namespace ts { return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit"); } + if (writeFileName) { + emittedOutputs.forEach(name => listEmittedFile(configFile, name)); + listFiles(program, writeFileName); + } + // Update time stamps for rest of the outputs newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); @@ -1182,6 +1187,8 @@ namespace ts { function buildErrors(diagnostics: ReadonlyArray, errorFlags: BuildResultFlags, errorType: string) { resultFlags |= errorFlags; reportAndStoreErrors(proj, diagnostics); + // List files if any other build error using program (emit errors already report files) + if (writeFileName) listFiles(program, writeFileName); projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); afterProgramCreate(proj, program); projectCompilerOptions = baseCompilerOptions; @@ -1189,6 +1196,12 @@ namespace ts { } } + function listEmittedFile(proj: ParsedCommandLine, file: string) { + if (writeFileName && proj.options.listEmittedFiles) { + writeFileName(`TSFILE: ${file}`); + } + } + function afterProgramCreate(proj: ResolvedConfigFileName, program: T) { if (host.afterProgramEmitAndDiagnostics) { host.afterProgramEmitAndDiagnostics(program); @@ -1229,9 +1242,9 @@ namespace ts { // Actual Emit Debug.assert(!!outputFiles.length); const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createFileMap(toPath as ToPath); + const emittedOutputs = createFileMap(toPath as ToPath); outputFiles.forEach(({ name, text, writeByteOrderMark }) => { - emittedOutputs.setValue(name, true); + emittedOutputs.setValue(name, name); writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); }); const emitDiagnostics = emitterDiagnostics.getDiagnostics(); @@ -1242,6 +1255,10 @@ namespace ts { return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors; } + if (writeFileName) { + emittedOutputs.forEach(name => listEmittedFile(config, name)); + } + // Update timestamps for dts const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); @@ -1270,7 +1287,7 @@ namespace ts { projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, status); } - function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { + function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames()); if (!skipOutputs || outputs.length !== skipOutputs.getSize()) { if (options.verbose) { @@ -1287,9 +1304,7 @@ namespace ts { } host.setModifiedTime(file, now); - if (proj.options.listEmittedFiles) { - writeFileName(`TSFILE: ${file}`); - } + listEmittedFile(proj, file); } } diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 9b08c54222f..f9bf2a8468d 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -121,6 +121,14 @@ namespace ts { emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; } + export function listFiles(program: ProgramToEmitFilesAndReportErrors, writeFileName: (s: string) => void) { + if (program.getCompilerOptions().listFiles) { + forEach(program.getSourceFiles(), file => { + writeFileName(file.fileName); + }); + } + } + /** * Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options */ @@ -152,12 +160,7 @@ namespace ts { const filepath = getNormalizedAbsolutePath(file, currentDir); writeFileName(`TSFILE: ${filepath}`); }); - - if (program.getCompilerOptions().listFiles) { - forEach(program.getSourceFiles(), file => { - writeFileName(file.fileName); - }); - } + listFiles(program, writeFileName); } if (reportSummary) { diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 6d128b348cc..588eb256eda 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -427,14 +427,14 @@ export class cNew {}`); builder.buildAllProjects(); assert.deepEqual(host.traces, [ "TSFILE: /src/core/anotherModule.js", - "TSFILE: /src/core/anotherModule.d.ts", "TSFILE: /src/core/anotherModule.d.ts.map", + "TSFILE: /src/core/anotherModule.d.ts", "TSFILE: /src/core/index.js", - "TSFILE: /src/core/index.d.ts", "TSFILE: /src/core/index.d.ts.map", + "TSFILE: /src/core/index.d.ts", "TSFILE: /src/core/tsconfig.tsbuildinfo", - "TSFILE: /src/logic/index.js", "TSFILE: /src/logic/index.js.map", + "TSFILE: /src/logic/index.js", "TSFILE: /src/logic/index.d.ts", "TSFILE: /src/logic/tsconfig.tsbuildinfo", "TSFILE: /src/tests/index.js", diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index 201c89c7b5b..7944d1fda09 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -65,6 +65,8 @@ export const b = new A();`); const expectedFileTraces = [ ...getLibs(), "/src/a.ts", + ...getLibs(), + "/src/b.ts" ]; verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "node"), allExpectedOutputs, From c07f219cca6a8bdf50f924e81ed47623bdb3ac86 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 15:29:32 -0700 Subject: [PATCH 21/48] Add failing test --- .../compiler/jsFileCompilationBindDeepExportsAssignment.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts diff --git a/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts new file mode 100644 index 00000000000..c4e53e2d4cf --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts @@ -0,0 +1,5 @@ +// @allowJs: true +// @noEmit: true +// @filename: a.js + +exports.a.b.c = 0; From d6df34bc4851ae0bde083ee2b5e9cd7d97f37510 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 2 Apr 2019 14:01:05 -0700 Subject: [PATCH 22/48] =?UTF-8?q?Don=E2=80=99t=20crash=20in=20forEachIdent?= =?UTF-8?q?ifierInEntityName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/binder.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index ff11b09f0fe..ad02d84a35b 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2710,8 +2710,7 @@ namespace ts { } else { const s = forEachIdentifierInEntityName(e.expression, parent, action); - if (!s || !s.exports) return Debug.fail(); - return action(e.name, s.exports.get(e.name.escapedText), s); + return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s); } } From 85135c38c1759de58bcc86f861ac4e408fdeb74e Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 2 Apr 2019 14:01:57 -0700 Subject: [PATCH 23/48] Add baselines for new test --- ...leCompilationBindDeepExportsAssignment.errors.txt | 8 ++++++++ ...sFileCompilationBindDeepExportsAssignment.symbols | 4 ++++ .../jsFileCompilationBindDeepExportsAssignment.types | 12 ++++++++++++ .../jsFileCompilationBindDeepExportsAssignment.ts | 1 + 4 files changed, 25 insertions(+) create mode 100644 tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt create mode 100644 tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols create mode 100644 tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types diff --git a/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt new file mode 100644 index 00000000000..11c68e5603f --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/a.js(1,9): error TS2339: Property 'a' does not exist on type 'typeof import("tests/cases/compiler/a")'. + + +==== tests/cases/compiler/a.js (1 errors) ==== + exports.a.b.c = 0; + ~ +!!! error TS2339: Property 'a' does not exist on type 'typeof import("tests/cases/compiler/a")'. + \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols new file mode 100644 index 00000000000..06acf3481da --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/a.js === +exports.a.b.c = 0; +>exports : Symbol("tests/cases/compiler/a", Decl(a.js, 0, 0)) + diff --git a/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types new file mode 100644 index 00000000000..a30ecf717c3 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/a.js === +exports.a.b.c = 0; +>exports.a.b.c = 0 : 0 +>exports.a.b.c : any +>exports.a.b : any +>exports.a : any +>exports : typeof import("tests/cases/compiler/a") +>a : any +>b : any +>c : any +>0 : 0 + diff --git a/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts index c4e53e2d4cf..5d3de3e0d2e 100644 --- a/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts +++ b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts @@ -1,5 +1,6 @@ // @allowJs: true // @noEmit: true +// @checkJs: true // @filename: a.js exports.a.b.c = 0; From b559e813f49a2440391e90eed264bdfb15edc7b0 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 2 Apr 2019 14:23:28 -0700 Subject: [PATCH 24/48] Add test when module resolution resolves to original file of referenced project with --out Test for #30591 --- .../unittests/tsbuild/amdModulesWithOut.ts | 45 +++++++++++++++++++ src/testRunner/unittests/tsbuild/helpers.ts | 5 ++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 28f80bd44cb..70f3fe187c8 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -198,6 +198,51 @@ ${internal} export enum internalEnum { a, b, c }`); modifyAgainFs: fs => replaceText(fs, sources[project.lib][source.ts][1], `export const`, `/*@internal*/ export const`), }); }); + + describe("when the module resolution finds original source file", () => { + function modifyFs(fs: vfs.FileSystem) { + // Make lib to output to parent dir + replaceText(fs, sources[project.lib][source.config], `"outFile": "module.js"`, `"outFile": "../module.js", "rootDir": "../"`); + // Change reference to file1 module to resolve to lib/file1 + replaceText(fs, sources[project.app][source.ts][0], "file1", "lib/file1"); + } + + const libOutputFile: OutputFile = [ + "/src/lib/module.js", + "/src/lib/module.js.map", + "/src/lib/module.d.ts", + "/src/lib/module.d.ts.map", + "/src/lib/module.tsbuildinfo" + ]; + verifyTsbuildOutput({ + scenario: "when the module resolution finds original source file", + projFs: () => outFileFs, + time, + tick, + proj: "amdModulesWithOut", + rootNames: ["/src/app"], + expectedMapFileNames: [ + libOutputFile[ext.jsmap], + libOutputFile[ext.dtsmap], + outputFiles[project.app][ext.jsmap], + outputFiles[project.app][ext.dtsmap], + ], + expectedBuildInfoFilesForSectionBaselines: [ + [libOutputFile[ext.buildinfo], libOutputFile[ext.js], libOutputFile[ext.dts]], + [outputFiles[project.app][ext.buildinfo], outputFiles[project.app][ext.js], outputFiles[project.app][ext.dts]] + ], + lastProjectOutputJs: outputFiles[project.app][ext.js], + initialBuild: { + modifyFs + }, + outputFiles: [ + ...libOutputFile, + ...outputFiles[project.app] + ], + baselineOnly: true, + verifyDiagnostics: true + }); + }); }); }); } diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 9672da1ff79..6915dd5d3b7 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -234,10 +234,11 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt incrementalDtsUnchangedBuild?: BuildState; incrementalHeaderChangedBuild?: BuildState; baselineOnly?: true; + verifyDiagnostics?: true; } export function verifyTsbuildOutput({ - scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly, + scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly, verifyDiagnostics, expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines, lastProjectOutputJs, initialBuild, incrementalDtsChangedBuild, incrementalDtsUnchangedBuild, incrementalHeaderChangedBuild }: VerifyTsBuildInput) { @@ -264,7 +265,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt host = undefined!; }); describe("initialBuild", () => { - if (!baselineOnly) { + if (!baselineOnly || verifyDiagnostics) { it(`verify diagnostics`, () => { host.assertDiagnosticMessages(...(initialBuild.expectedDiagnostics || emptyArray)); }); From 602aec2f7d9cd539f71c6c81f42985d8916a1422 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 2 Apr 2019 14:37:00 -0700 Subject: [PATCH 25/48] Never create redirect for sourceFiles that get emitted to single output file Fixes #30591 --- src/compiler/program.ts | 23 +- .../unittests/tsbuild/amdModulesWithOut.ts | 9 +- ...e-resolution-finds-original-source-file.js | 573 ++++++++++++++++++ 3 files changed, 598 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 6418f55968b..ad3121860ad 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2266,8 +2266,13 @@ namespace ts { let redirectedPath: Path | undefined; if (refFile) { - const redirect = getProjectReferenceRedirect(fileName); - if (redirect) { + const redirectProject = getProjectReferenceRedirectProject(fileName); + if (redirectProject) { + if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) { + // Shouldnt create many to 1 mapping file in --out scenario + return undefined; + } + const redirect = getProjectReferenceOutputName(redirectProject, fileName); fileName = redirect; // Once we start redirecting to a file, we can potentially come back to it // via a back-reference from another file in the .d.ts folder. If that happens we'll @@ -2364,6 +2369,11 @@ namespace ts { } function getProjectReferenceRedirect(fileName: string): string | undefined { + const referencedProject = getProjectReferenceRedirectProject(fileName); + return referencedProject && getProjectReferenceOutputName(referencedProject, fileName); + } + + function getProjectReferenceRedirectProject(fileName: string) { // Ignore dts or any of the non ts files if (!resolvedProjectReferences || !resolvedProjectReferences.length || fileExtensionIs(fileName, Extension.Dts) || !fileExtensionIsOneOf(fileName, supportedTSExtensions)) { return undefined; @@ -2371,10 +2381,11 @@ namespace ts { // If this file is produced by a referenced project, we need to rewrite it to // look in the output folder of the referenced project rather than the input - const referencedProject = getResolvedProjectReferenceToRedirect(fileName); - if (!referencedProject) { - return undefined; - } + return getResolvedProjectReferenceToRedirect(fileName); + } + + + function getProjectReferenceOutputName(referencedProject: ResolvedProjectReference, fileName: string) { const out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out; return out ? changeExtension(out, Extension.Dts) : diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 70f3fe187c8..3e1cab9b4a0 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -233,7 +233,14 @@ ${internal} export enum internalEnum { a, b, c }`); ], lastProjectOutputJs: outputFiles[project.app][ext.js], initialBuild: { - modifyFs + modifyFs, + expectedDiagnostics: [ + getExpectedDiagnosticForProjectsInBuild("src/lib/tsconfig.json", "src/app/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/lib/tsconfig.json", "src/module.js"], + [Diagnostics.Building_project_0, sources[project.lib][source.config]], + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/app/tsconfig.json", "src/app/module.js"], + [Diagnostics.Building_project_0, sources[project.app][source.config]], + ] }, outputFiles: [ ...libOutputFile, diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js new file mode 100644 index 00000000000..119eb04f23a --- /dev/null +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js @@ -0,0 +1,573 @@ +//// [/src/app/file3.ts] +export const z = 30; +import { x } from "lib/file1"; + +//// [/src/app/module.d.ts] +declare const myGlob = 20; +declare module "lib/file1" { + export const x = 10; +} +declare module "lib/file2" { + export const y = 20; +} +declare const globalConst = 10; +declare module "file3" { + export const z = 30; +} +declare const myVar = 30; +//# sourceMappingURL=module.d.ts.map + +//// [/src/app/module.d.ts.map] +{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC;;ICAvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,KAAK,KAAK,CAAC"} + +//// [/src/app/module.d.ts.map.baseline.txt] +=================================================================== +JsFile: module.d.ts +mapUrl: module.d.ts.map +sourceRoot: +sources: ../lib/file0.ts,../lib/file1.ts,../lib/file2.ts,../lib/global.ts,file3.ts,file4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/file0.ts +------------------------------------------------------------------- +>>>declare const myGlob = 20; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^ +5 > ^^^^^ +6 > ^ +7 > ^^^-> +1 > +2 > +3 > const +4 > myGlob +5 > = 20 +6 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 9) Source(1, 1) + SourceIndex(0) +3 >Emitted(1, 15) Source(1, 7) + SourceIndex(0) +4 >Emitted(1, 21) Source(1, 13) + SourceIndex(0) +5 >Emitted(1, 26) Source(1, 18) + SourceIndex(0) +6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/file1.ts +------------------------------------------------------------------- +>>>declare module "lib/file1" { +>>> export const x = 10; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> +2 > export +3 > +4 > const +5 > x +6 > = 10 +7 > ; +1->Emitted(3, 5) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 11) Source(1, 7) + SourceIndex(1) +3 >Emitted(3, 12) Source(1, 8) + SourceIndex(1) +4 >Emitted(3, 18) Source(1, 14) + SourceIndex(1) +5 >Emitted(3, 19) Source(1, 15) + SourceIndex(1) +6 >Emitted(3, 24) Source(1, 20) + SourceIndex(1) +7 >Emitted(3, 25) Source(1, 21) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/file2.ts +------------------------------------------------------------------- +>>>} +>>>declare module "lib/file2" { +>>> export const y = 20; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1 > +2 > export +3 > +4 > const +5 > y +6 > = 20 +7 > ; +1 >Emitted(6, 5) Source(1, 1) + SourceIndex(2) +2 >Emitted(6, 11) Source(1, 7) + SourceIndex(2) +3 >Emitted(6, 12) Source(1, 8) + SourceIndex(2) +4 >Emitted(6, 18) Source(1, 14) + SourceIndex(2) +5 >Emitted(6, 19) Source(1, 15) + SourceIndex(2) +6 >Emitted(6, 24) Source(1, 20) + SourceIndex(2) +7 >Emitted(6, 25) Source(1, 21) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/global.ts +------------------------------------------------------------------- +>>>} +>>>declare const globalConst = 10; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^^^^^^ +5 > ^^^^^ +6 > ^ +1 > +2 > +3 > const +4 > globalConst +5 > = 10 +6 > ; +1 >Emitted(8, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(8, 9) Source(1, 1) + SourceIndex(3) +3 >Emitted(8, 15) Source(1, 7) + SourceIndex(3) +4 >Emitted(8, 26) Source(1, 18) + SourceIndex(3) +5 >Emitted(8, 31) Source(1, 23) + SourceIndex(3) +6 >Emitted(8, 32) Source(1, 24) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:file3.ts +------------------------------------------------------------------- +>>>declare module "file3" { +>>> export const z = 30; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1 > +2 > export +3 > +4 > const +5 > z +6 > = 30 +7 > ; +1 >Emitted(10, 5) Source(1, 1) + SourceIndex(4) +2 >Emitted(10, 11) Source(1, 7) + SourceIndex(4) +3 >Emitted(10, 12) Source(1, 8) + SourceIndex(4) +4 >Emitted(10, 18) Source(1, 14) + SourceIndex(4) +5 >Emitted(10, 19) Source(1, 15) + SourceIndex(4) +6 >Emitted(10, 24) Source(1, 20) + SourceIndex(4) +7 >Emitted(10, 25) Source(1, 21) + SourceIndex(4) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:file4.ts +------------------------------------------------------------------- +>>>} +>>>declare const myVar = 30; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^^^-> +1 > +2 > +3 > const +4 > myVar +5 > = 30 +6 > ; +1 >Emitted(12, 1) Source(1, 1) + SourceIndex(5) +2 >Emitted(12, 9) Source(1, 1) + SourceIndex(5) +3 >Emitted(12, 15) Source(1, 7) + SourceIndex(5) +4 >Emitted(12, 20) Source(1, 12) + SourceIndex(5) +5 >Emitted(12, 25) Source(1, 17) + SourceIndex(5) +6 >Emitted(12, 26) Source(1, 18) + SourceIndex(5) +--- +>>>//# sourceMappingURL=module.d.ts.map + +//// [/src/app/module.js] +var myGlob = 20; +define("lib/file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.x = 10; +}); +define("lib/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = 20; +}); +var globalConst = 10; +define("file3", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.z = 30; +}); +var myVar = 30; +//# sourceMappingURL=module.js.map + +//// [/src/app/module.js.map] +{"version":3,"file":"module.js","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AAAA,IAAM,MAAM,GAAG,EAAE,CAAC;;;;ICAL,QAAA,CAAC,GAAG,EAAE,CAAC;;;;;ICAP,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,WAAW,GAAG,EAAE,CAAC;;;;ICAV,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,KAAK,GAAG,EAAE,CAAC"} + +//// [/src/app/module.js.map.baseline.txt] +=================================================================== +JsFile: module.js +mapUrl: module.js.map +sourceRoot: +sources: ../lib/file0.ts,../lib/file1.ts,../lib/file2.ts,../lib/global.ts,file3.ts,file4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/file0.ts +------------------------------------------------------------------- +>>>var myGlob = 20; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >const +3 > myGlob +4 > = +5 > 20 +6 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 13) + SourceIndex(0) +4 >Emitted(1, 14) Source(1, 16) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 18) + SourceIndex(0) +6 >Emitted(1, 17) Source(1, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/file1.ts +------------------------------------------------------------------- +>>>define("lib/file1", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.x = 10; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1->export const +2 > +3 > x +4 > = +5 > 10 +6 > ; +1->Emitted(5, 5) Source(1, 14) + SourceIndex(1) +2 >Emitted(5, 13) Source(1, 14) + SourceIndex(1) +3 >Emitted(5, 14) Source(1, 15) + SourceIndex(1) +4 >Emitted(5, 17) Source(1, 18) + SourceIndex(1) +5 >Emitted(5, 19) Source(1, 20) + SourceIndex(1) +6 >Emitted(5, 20) Source(1, 21) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/file2.ts +------------------------------------------------------------------- +>>>}); +>>>define("lib/file2", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.y = 20; +1 >^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1 >export const +2 > +3 > y +4 > = +5 > 20 +6 > ; +1 >Emitted(10, 5) Source(1, 14) + SourceIndex(2) +2 >Emitted(10, 13) Source(1, 14) + SourceIndex(2) +3 >Emitted(10, 14) Source(1, 15) + SourceIndex(2) +4 >Emitted(10, 17) Source(1, 18) + SourceIndex(2) +5 >Emitted(10, 19) Source(1, 20) + SourceIndex(2) +6 >Emitted(10, 20) Source(1, 21) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/global.ts +------------------------------------------------------------------- +>>>}); +>>>var globalConst = 10; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >const +3 > globalConst +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(12, 5) Source(1, 7) + SourceIndex(3) +3 >Emitted(12, 16) Source(1, 18) + SourceIndex(3) +4 >Emitted(12, 19) Source(1, 21) + SourceIndex(3) +5 >Emitted(12, 21) Source(1, 23) + SourceIndex(3) +6 >Emitted(12, 22) Source(1, 24) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:file3.ts +------------------------------------------------------------------- +>>>define("file3", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.z = 30; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1->export const +2 > +3 > z +4 > = +5 > 30 +6 > ; +1->Emitted(16, 5) Source(1, 14) + SourceIndex(4) +2 >Emitted(16, 13) Source(1, 14) + SourceIndex(4) +3 >Emitted(16, 14) Source(1, 15) + SourceIndex(4) +4 >Emitted(16, 17) Source(1, 18) + SourceIndex(4) +5 >Emitted(16, 19) Source(1, 20) + SourceIndex(4) +6 >Emitted(16, 20) Source(1, 21) + SourceIndex(4) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:file4.ts +------------------------------------------------------------------- +>>>}); +>>>var myVar = 30; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 >const +3 > myVar +4 > = +5 > 30 +6 > ; +1 >Emitted(18, 1) Source(1, 1) + SourceIndex(5) +2 >Emitted(18, 5) Source(1, 7) + SourceIndex(5) +3 >Emitted(18, 10) Source(1, 12) + SourceIndex(5) +4 >Emitted(18, 13) Source(1, 15) + SourceIndex(5) +5 >Emitted(18, 15) Source(1, 17) + SourceIndex(5) +6 >Emitted(18, 16) Source(1, 18) + SourceIndex(5) +--- +>>>//# sourceMappingURL=module.js.map + +//// [/src/app/module.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "/src/app/", + "sourceFiles": [ + "/src/app/file3.ts", + "/src/app/file4.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 417, + "kind": "prepend", + "data": "/src/module.js", + "texts": [ + { + "pos": 0, + "end": 417, + "kind": "text" + } + ] + }, + { + "pos": 417, + "end": 618, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 179, + "kind": "prepend", + "data": "/src/module.d.ts", + "texts": [ + { + "pos": 0, + "end": 179, + "kind": "text" + } + ] + }, + { + "pos": 179, + "end": 261, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/app/module.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/app/module.js +---------------------------------------------------------------------- +prepend: (0-417):: /src/module.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-417) +var myGlob = 20; +define("lib/file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.x = 10; +}); +define("lib/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = 20; +}); +var globalConst = 10; + +---------------------------------------------------------------------- +text: (417-618) +define("file3", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.z = 30; +}); +var myVar = 30; + +====================================================================== +====================================================================== +File:: /src/app/module.d.ts +---------------------------------------------------------------------- +prepend: (0-179):: /src/module.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-179) +declare const myGlob = 20; +declare module "lib/file1" { + export const x = 10; +} +declare module "lib/file2" { + export const y = 20; +} +declare const globalConst = 10; + +---------------------------------------------------------------------- +text: (179-261) +declare module "file3" { + export const z = 30; +} +declare const myVar = 30; + +====================================================================== + +//// [/src/lib/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "module": "amd", + "composite": true, + "sourceMap": true, + "declarationMap": true, + "strict": false, + "outFile": "../module.js", "rootDir": "../" + }, + "exclude": ["module.d.ts"] + +} + +//// [/src/module.d.ts] +declare const myGlob = 20; +declare module "lib/file1" { + export const x = 10; +} +declare module "lib/file2" { + export const y = 20; +} +declare const globalConst = 10; +//# sourceMappingURL=module.d.ts.map + +//// [/src/module.d.ts.map] +{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC"} + +//// [/src/module.js] +var myGlob = 20; +define("lib/file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.x = 10; +}); +define("lib/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = 20; +}); +var globalConst = 10; +//# sourceMappingURL=module.js.map + +//// [/src/module.js.map] +{"version":3,"file":"module.js","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,IAAM,MAAM,GAAG,EAAE,CAAC;;;;ICAL,QAAA,CAAC,GAAG,EAAE,CAAC;;;;;ICAP,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,WAAW,GAAG,EAAE,CAAC"} + +//// [/src/module.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "/src/", + "sourceFiles": [ + "/src/lib/file0.ts", + "/src/lib/file1.ts", + "/src/lib/file2.ts", + "/src/lib/global.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 417, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 179, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + From f04a40dd493626ffa7811b8c4d4054a37e7cb1c9 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 2 Apr 2019 17:15:40 -0700 Subject: [PATCH 26/48] Treat hoisted temp variables as a custom prologue --- src/compiler/transformer.ts | 2 + .../reference/asyncArrowFunction11_es5.js | 3 +- .../reference/asyncArrowFunction8_es5.js | 3 +- .../asyncFunctionDeclaration9_es5.js | 3 +- .../bindingPatternOmittedExpressionNesting.js | 2 +- ...blockScopedBindingsInDownlevelGenerator.js | 13 ++--- ...poundExponentiationAssignmentLHSIsValue.js | 3 +- ...EmitComputedNameCausesImportToBePainted.js | 2 +- ...clarationEmitComputedNameConstEnumAlias.js | 2 +- ...tPrivateSymbolCausesVarDeclarationEmit2.js | 4 +- ...eclarationEmitWithDefaultAsComputedName.js | 2 +- ...clarationEmitWithDefaultAsComputedName2.js | 2 +- .../decoratedClassExportsCommonJS1.js | 2 +- .../decoratedClassExportsCommonJS2.js | 2 +- .../emitClassExpressionInDeclarationFile2.js | 2 +- .../reference/emitter.forAwait.es2015.js | 6 +-- .../reference/emitter.forAwait.es5.js | 18 ++++--- .../es5-asyncFunctionForOfStatements.js | 50 +++++++++++-------- .../es5-asyncFunctionObjectLiterals.js | 24 +++++---- ...ctLiteralComputedNameNoDeclarationError.js | 2 +- .../restParameterInDownlevelGenerator.js | 32 ++++++++++++ .../restParameterInDownlevelGenerator.symbols | 10 ++++ .../restParameterInDownlevelGenerator.types | 10 ++++ ...olAllowsIndexInObjectWithIndexSignature.js | 2 +- ...arationEmitUniqueSymbolPartialStatement.js | 2 +- .../restParameterInDownlevelGenerator.ts | 9 ++++ 26 files changed, 146 insertions(+), 66 deletions(-) create mode 100644 tests/baselines/reference/restParameterInDownlevelGenerator.js create mode 100644 tests/baselines/reference/restParameterInDownlevelGenerator.symbols create mode 100644 tests/baselines/reference/restParameterInDownlevelGenerator.types create mode 100644 tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index d8a2848bcc3..12d20d6c089 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -327,6 +327,8 @@ namespace ts { createVariableDeclarationList(lexicalEnvironmentVariableDeclarations) ); + setEmitFlags(statement, EmitFlags.CustomPrologue); + if (!statements) { statements = [statement]; } diff --git a/tests/baselines/reference/asyncArrowFunction11_es5.js b/tests/baselines/reference/asyncArrowFunction11_es5.js index 013941c96ca..5f234f2fbf6 100644 --- a/tests/baselines/reference/asyncArrowFunction11_es5.js +++ b/tests/baselines/reference/asyncArrowFunction11_es5.js @@ -53,7 +53,8 @@ var A = /** @class */ (function () { args[_i] = arguments[_i]; } return __awaiter(_this, void 0, void 0, function () { - var _a, obj; + var obj; + var _a; var _this = this; return __generator(this, function (_b) { switch (_b.label) { diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.js b/tests/baselines/reference/asyncArrowFunction8_es5.js index 7e9e5a492be..aae263255b3 100644 --- a/tests/baselines/reference/asyncArrowFunction8_es5.js +++ b/tests/baselines/reference/asyncArrowFunction8_es5.js @@ -6,7 +6,8 @@ var foo = async (): Promise => { //// [asyncArrowFunction8_es5.js] var _this = this; var foo = function () { return __awaiter(_this, void 0, void 0, function () { - var _a, v; + var v; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js index 2fd29408422..505ed08d840 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js @@ -6,7 +6,8 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es5.js] function foo() { return __awaiter(this, void 0, void 0, function () { - var _a, v; + var v; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js index e8a8e02a6a1..36fd6a11fad 100644 --- a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js +++ b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js @@ -3,8 +3,8 @@ export let [,,[,[],,[],]] = undefined as any; //// [bindingPatternOmittedExpressionNesting.js] "use strict"; -exports.__esModule = true; var _a, _b, _c, _d; +exports.__esModule = true; exports._e = (_a = undefined, _b = _a[2], _c = _b[1], _d = _b[3]); diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js index e177b7d4a0a..9bb07d80b00 100644 --- a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js @@ -45,7 +45,8 @@ var __values = (this && this.__values) || function (o) { }; }; function a() { - var e_1, _a, _loop_1, _b, _c, i, e_1_1; + var _loop_1, _a, _b, i, e_1_1; + var e_1, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: @@ -64,17 +65,17 @@ function a() { _d.label = 1; case 1: _d.trys.push([1, 6, 7, 8]); - _b = __values([1, 2, 3]), _c = _b.next(); + _a = __values([1, 2, 3]), _b = _a.next(); _d.label = 2; case 2: - if (!!_c.done) return [3 /*break*/, 5]; - i = _c.value; + if (!!_b.done) return [3 /*break*/, 5]; + i = _b.value; return [5 /*yield**/, _loop_1(i)]; case 3: _d.sent(); _d.label = 4; case 4: - _c = _b.next(); + _b = _a.next(); return [3 /*break*/, 2]; case 5: return [3 /*break*/, 8]; case 6: @@ -83,7 +84,7 @@ function a() { return [3 /*break*/, 8]; case 7: try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); } finally { if (e_1) throw e_1.error; } return [7 /*endfinally*/]; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index c5aa9eeb681..b3e1312cd69 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -148,9 +148,8 @@ _a = Math.pow(['', ''], value), '' = _a[0], '' = _a[1]; var Derived = /** @class */ (function (_super) { __extends(Derived, _super); function Derived() { - var _this = this; var _a; - _this = _super.call(this) || this; + var _this = _super.call(this) || this; (_a = _super.prototype). = Math.pow(_a., value); return _this; } diff --git a/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js b/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js index ee97c6b2182..65572cd4316 100644 --- a/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js +++ b/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js @@ -20,8 +20,8 @@ exports.__esModule = true; exports.Key = Symbol(); //// [index.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var context_1 = require("./context"); exports.context = (_a = {}, _a[context_1.Key] = 'bar', diff --git a/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js b/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js index 461eb21087e..93ae03a820b 100644 --- a/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js +++ b/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js @@ -24,8 +24,8 @@ var EnumExample; exports["default"] = EnumExample; //// [index.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var EnumExample_1 = require("./EnumExample"); exports["default"] = (_a = {}, _a[EnumExample_1["default"].TEST] = {}, diff --git a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js index b78c104f468..ab986aba1e8 100644 --- a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js +++ b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js @@ -25,8 +25,8 @@ exports.__esModule = true; exports.x = Symbol(); //// [b.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var a_1 = require("./a"); var C = /** @class */ (function () { function C() { @@ -51,8 +51,8 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -exports.__esModule = true; var _a; +exports.__esModule = true; var a_1 = require("./a"); var b_1 = require("./b"); var D = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js index ae45c09438f..89877887cd9 100644 --- a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js +++ b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js @@ -25,8 +25,8 @@ exports.default = createExperiment({ }); //// [main.js] "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); var _a; +Object.defineProperty(exports, "__esModule", { value: true }); var other_1 = require("./other"); exports.obj = (_a = {}, _a[other_1.default.name] = 1, diff --git a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js index ddf89f2d57d..24db1560dca 100644 --- a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js +++ b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js @@ -25,8 +25,8 @@ exports.default = createExperiment({ }); //// [main.js] "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); var _a; +Object.defineProperty(exports, "__esModule", { value: true }); var other2 = require("./other"); exports.obj = (_a = {}, _a[other2.default.name] = 1, diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS1.js b/tests/baselines/reference/decoratedClassExportsCommonJS1.js index befb1f9586b..d9ba6a5ce12 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS1.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS1.js @@ -14,8 +14,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -Object.defineProperty(exports, "__esModule", { value: true }); var Testing123_1; +Object.defineProperty(exports, "__esModule", { value: true }); let Testing123 = Testing123_1 = class Testing123 { }; Testing123.prop1 = Testing123_1.prop0; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS2.js b/tests/baselines/reference/decoratedClassExportsCommonJS2.js index b93e63c7406..2ed37afa881 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS2.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS2.js @@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -Object.defineProperty(exports, "__esModule", { value: true }); var Testing123_1; +Object.defineProperty(exports, "__esModule", { value: true }); let Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ diff --git a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js index c3af6416868..fbeae9f8a4f 100644 --- a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js +++ b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js @@ -44,8 +44,8 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -exports.__esModule = true; var _a; +exports.__esModule = true; exports.noPrivates = (_a = /** @class */ (function () { function class_1() { this.p = 12; diff --git a/tests/baselines/reference/emitter.forAwait.es2015.js b/tests/baselines/reference/emitter.forAwait.es2015.js index 6260870471b..e5764747765 100644 --- a/tests/baselines/reference/emitter.forAwait.es2015.js +++ b/tests/baselines/reference/emitter.forAwait.es2015.js @@ -58,8 +58,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f1() { + var e_1, _a; return __awaiter(this, void 0, void 0, function* () { - var e_1, _a; let y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { @@ -92,8 +92,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f2() { + var e_1, _a; return __awaiter(this, void 0, void 0, function* () { - var e_1, _a; let x, y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { @@ -203,8 +203,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; // https://github.com/Microsoft/TypeScript/issues/21363 function f5() { + var e_1, _a; return __awaiter(this, void 0, void 0, function* () { - var e_1, _a; let y; try { outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { diff --git a/tests/baselines/reference/emitter.forAwait.es5.js b/tests/baselines/reference/emitter.forAwait.es5.js index f264820d3b1..0d67c591e30 100644 --- a/tests/baselines/reference/emitter.forAwait.es5.js +++ b/tests/baselines/reference/emitter.forAwait.es5.js @@ -85,8 +85,9 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f1() { + var e_1, _a; return __awaiter(this, void 0, void 0, function () { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -165,8 +166,9 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f2() { + var e_1, _a; return __awaiter(this, void 0, void 0, function () { - var e_1, _a, x, y, y_1, y_1_1, e_1_1; + var x, y, y_1, y_1_1, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -250,7 +252,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f3() { return __asyncGenerator(this, arguments, function f3_1() { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; + var e_1, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -334,7 +337,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f4() { return __asyncGenerator(this, arguments, function f4_1() { - var e_1, _a, x, y, y_1, y_1_1, e_1_1; + var x, y, y_1, y_1_1, e_1_1; + var e_1, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -414,8 +418,9 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; // https://github.com/Microsoft/TypeScript/issues/21363 function f5() { + var e_1, _a; return __awaiter(this, void 0, void 0, function () { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -500,7 +505,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar // https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return __asyncGenerator(this, arguments, function f6_1() { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; + var e_1, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js index 5fbeef0461a..7ae556f9419 100644 --- a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js @@ -315,7 +315,8 @@ function forOfStatement10() { } function forOfStatement11() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_8, _b; + var _i, y_8, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: @@ -323,17 +324,17 @@ function forOfStatement11() { _c.label = 1; case 1: if (!(_i < y_8.length)) return [3 /*break*/, 6]; - _a = y_8[_i][0]; - if (!(_a === void 0)) return [3 /*break*/, 3]; + _b = y_8[_i][0]; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: - _b = _c.sent(); + _a = _c.sent(); return [3 /*break*/, 4]; case 3: - _b = _a; + _a = _b; _c.label = 4; case 4: - x = _b; + x = _a; z; _c.label = 5; case 5: @@ -346,18 +347,19 @@ function forOfStatement11() { } function forOfStatement12() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, _b; + var _i, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; return [4 /*yield*/, y]; case 1: - _b = _c.sent(); + _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _b.length)) return [3 /*break*/, 4]; - _a = _b[_i][0], x = _a === void 0 ? a : _a; + if (!(_i < _a.length)) return [3 /*break*/, 4]; + _b = _a[_i][0], x = _b === void 0 ? a : _b; z; _c.label = 3; case 3: @@ -370,7 +372,8 @@ function forOfStatement12() { } function forOfStatement13() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_9; + var _i, y_9; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -440,7 +443,8 @@ function forOfStatement15() { } function forOfStatement16() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_11, _b; + var _i, y_11, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: @@ -448,17 +452,17 @@ function forOfStatement16() { _c.label = 1; case 1: if (!(_i < y_11.length)) return [3 /*break*/, 6]; - _a = y_11[_i].x; - if (!(_a === void 0)) return [3 /*break*/, 3]; + _b = y_11[_i].x; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: - _b = _c.sent(); + _a = _c.sent(); return [3 /*break*/, 4]; case 3: - _b = _a; + _a = _b; _c.label = 4; case 4: - x = _b; + x = _a; z; _c.label = 5; case 5: @@ -471,18 +475,19 @@ function forOfStatement16() { } function forOfStatement17() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, _b; + var _i, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; return [4 /*yield*/, y]; case 1: - _b = _c.sent(); + _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _b.length)) return [3 /*break*/, 4]; - _a = _b[_i].x, x = _a === void 0 ? a : _a; + if (!(_i < _a.length)) return [3 /*break*/, 4]; + _b = _a[_i].x, x = _b === void 0 ? a : _b; z; _c.label = 3; case 3: @@ -495,7 +500,8 @@ function forOfStatement17() { } function forOfStatement18() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_12; + var _i, y_12; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js index de1aab50b51..e6031d256af 100644 --- a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js +++ b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js @@ -105,17 +105,18 @@ function objectLiteral2() { } function objectLiteral3() { return __awaiter(this, void 0, void 0, function () { - var _a, _b; + var _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: - _a = {}; - _b = a; + _b = {}; + _a = a; return [4 /*yield*/, y]; case 1: - x = (_a[_b] = _c.sent(), - _a.b = z, - _a); + x = (_b[_a] = _c.sent(), + _b.b = z, + _b); return [2 /*return*/]; } }); @@ -158,18 +159,19 @@ function objectLiteral5() { } function objectLiteral6() { return __awaiter(this, void 0, void 0, function () { - var _a, _b; + var _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: - _a = { + _b = { a: y }; - _b = b; + _a = b; return [4 /*yield*/, z]; case 1: - x = (_a[_b] = _c.sent(), - _a); + x = (_b[_a] = _c.sent(), + _b); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js b/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js index 5c5e5feccd8..8f9b43d091d 100644 --- a/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js +++ b/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js @@ -9,8 +9,8 @@ export const Baa = { //// [objectLiteralComputedNameNoDeclarationError.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var Foo = { BANANA: 'banana' }; diff --git a/tests/baselines/reference/restParameterInDownlevelGenerator.js b/tests/baselines/reference/restParameterInDownlevelGenerator.js new file mode 100644 index 00000000000..3a1dbe6a7ac --- /dev/null +++ b/tests/baselines/reference/restParameterInDownlevelGenerator.js @@ -0,0 +1,32 @@ +//// [restParameterInDownlevelGenerator.ts] +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { + for (var str of strings); +} + +//// [restParameterInDownlevelGenerator.js] +// https://github.com/Microsoft/TypeScript/issues/30653 +function mergeStringLists() { + var _i, strings_1, strings_1_1, str; + var e_1, _a; + var strings = []; + for (_i = 0; _i < arguments.length; _i++) { + strings[_i] = arguments[_i]; + } + return __generator(this, function (_b) { + try { + for (strings_1 = __values(strings), strings_1_1 = strings_1.next(); !strings_1_1.done; strings_1_1 = strings_1.next()) { + str = strings_1_1.value; + ; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (strings_1_1 && !strings_1_1.done && (_a = strings_1.return)) _a.call(strings_1); + } + finally { if (e_1) throw e_1.error; } + } + return [2 /*return*/]; + }); +} diff --git a/tests/baselines/reference/restParameterInDownlevelGenerator.symbols b/tests/baselines/reference/restParameterInDownlevelGenerator.symbols new file mode 100644 index 00000000000..bc15dd540ff --- /dev/null +++ b/tests/baselines/reference/restParameterInDownlevelGenerator.symbols @@ -0,0 +1,10 @@ +=== tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts === +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { +>mergeStringLists : Symbol(mergeStringLists, Decl(restParameterInDownlevelGenerator.ts, 0, 0)) +>strings : Symbol(strings, Decl(restParameterInDownlevelGenerator.ts, 1, 28)) + + for (var str of strings); +>str : Symbol(str, Decl(restParameterInDownlevelGenerator.ts, 2, 12)) +>strings : Symbol(strings, Decl(restParameterInDownlevelGenerator.ts, 1, 28)) +} diff --git a/tests/baselines/reference/restParameterInDownlevelGenerator.types b/tests/baselines/reference/restParameterInDownlevelGenerator.types new file mode 100644 index 00000000000..e0b85e1a0ff --- /dev/null +++ b/tests/baselines/reference/restParameterInDownlevelGenerator.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts === +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { +>mergeStringLists : (...strings: string[]) => IterableIterator +>strings : string[] + + for (var str of strings); +>str : string +>strings : string[] +} diff --git a/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js b/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js index f74ff6d2c2b..911f3abf7c4 100644 --- a/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js +++ b/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js @@ -13,8 +13,8 @@ let b: I = {[SYM]: 'str'}; // Expect error //// [uniqueSymbolAllowsIndexInObjectWithIndexSignature.js] "use strict"; -exports.__esModule = true; var _a, _b; +exports.__esModule = true; // https://github.com/Microsoft/TypeScript/issues/21962 exports.SYM = Symbol('a unique symbol'); var a = (_a = {}, _a[exports.SYM] = 'sym', _a); // Expect ok diff --git a/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js b/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js index f2a1df5e707..21871ff2304 100644 --- a/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js +++ b/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js @@ -7,8 +7,8 @@ export class Foo { //// [variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var key = Symbol(), value = 12; var Foo = /** @class */ (function () { function Foo() { diff --git a/tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts b/tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts new file mode 100644 index 00000000000..bb98fb0f742 --- /dev/null +++ b/tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts @@ -0,0 +1,9 @@ +// @target: es5 +// @lib: es2015 +// @downlevelIteration: true +// @noEmitHelpers: true + +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { + for (var str of strings); +} \ No newline at end of file From 3c8ce9b31641daefdd00d128248e422ae84a1cbe Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 3 Apr 2019 08:32:51 -0400 Subject: [PATCH 27/48] Addressed quick feedback items --- src/compiler/checker.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b834cb3a89b..cc760369367 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1119,7 +1119,8 @@ namespace ts { return !findAncestor(usage, n => isComputedPropertyName(n) && n.parent.parent === declaration); } else if (isPropertyDeclaration(declaration)) { - return isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage); + // still might be illegal if a self-referencing property initializer (eg private x = this.x) + return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage); } return true; } @@ -1199,7 +1200,7 @@ namespace ts { function isPropertyImmediatelyReferencedWithinDeclaration(declaration: PropertyDeclaration, usage: Node) { // always legal if usage is after declaration if (usage.end > declaration.end) { - return true; + return false; } // still might be legal if usage is deferred (e.g. x: any = () => this.x) @@ -1227,7 +1228,7 @@ namespace ts { } }); - return ancestorChangingReferenceScope !== undefined; + return ancestorChangingReferenceScope === undefined; } } From 6661f90b44f16d4c784bf2f29de003300c6e8003 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 3 Apr 2019 09:00:42 -0400 Subject: [PATCH 28/48] Accepted odd new baseline --- .../baselines/reference/classUsedBeforeInitializedVariables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/baselines/reference/classUsedBeforeInitializedVariables.js b/tests/baselines/reference/classUsedBeforeInitializedVariables.js index 3a3591cfdad..4442c7193d6 100644 --- a/tests/baselines/reference/classUsedBeforeInitializedVariables.js +++ b/tests/baselines/reference/classUsedBeforeInitializedVariables.js @@ -55,8 +55,8 @@ var __extends = (this && this.__extends) || (function () { })(); var Test = /** @class */ (function () { function Test() { - var _a, _b, _c; var _this = this; + var _a, _b, _c; this.p1 = 0; this.p2 = this.p1; this.p3 = this.p4; From 75a812b4db8f76bad3db073603f34594fd12c07d Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 3 Apr 2019 19:49:34 +0300 Subject: [PATCH 29/48] add new message - TS1258 (#30704) --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 4 ++++ .../definiteAssignmentAssertions.errors.txt | 20 +++++++++---------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 93e66dd05e4..b9e5bcaeddf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -31462,7 +31462,7 @@ namespace ts { } if (node.exclamationToken && (node.parent.parent.kind !== SyntaxKind.VariableStatement || !node.type || node.initializer || node.flags & NodeFlags.Ambient)) { - return grammarErrorOnNode(node.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); + return grammarErrorOnNode(node.exclamationToken, Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation); } if (compilerOptions.module !== ModuleKind.ES2015 && compilerOptions.module !== ModuleKind.ESNext && compilerOptions.module !== ModuleKind.System && !compilerOptions.noEmit && diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6cb498df827..7717f51bd50 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -847,6 +847,10 @@ "category": "Error", "code": 1257 }, + "Definite assignment assertions can only be used along with a type annotation.": { + "category": "Error", + "code": 1258 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", "code": 1300 diff --git a/tests/baselines/reference/definiteAssignmentAssertions.errors.txt b/tests/baselines/reference/definiteAssignmentAssertions.errors.txt index d65d9b510ae..dea5e45aa82 100644 --- a/tests/baselines/reference/definiteAssignmentAssertions.errors.txt +++ b/tests/baselines/reference/definiteAssignmentAssertions.errors.txt @@ -4,11 +4,11 @@ tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(21,6): error tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(22,13): error TS1255: A definite assignment assertion '!' is not permitted in this context. tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(28,6): error TS1255: A definite assignment assertion '!' is not permitted in this context. tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(34,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(68,10): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(69,10): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(70,10): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(75,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(68,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(69,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(70,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(75,15): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): error TS1258: Definite assignment assertions can only be used along with a type annotation. ==== tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts (11 errors) ==== @@ -93,21 +93,21 @@ tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): erro function f4() { let a!; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. let b! = 1; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. let c!: number = 1; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. } // Definite assignment assertion not permitted in ambient context declare let v1!: number; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. declare var v2!: number; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. \ No newline at end of file From 78b095647477b6f47d68f72a96252829e61e437c Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Wed, 3 Apr 2019 10:36:04 -0700 Subject: [PATCH 30/48] VS IntelliCode-related changes (#30731) * ensure configurePlugin gives a response * Update tests * Update baseline * Enable global plugin loading for external projects * Fix lint errors --- src/harness/client.ts | 8 ++- src/server/editorServices.ts | 3 +- src/server/project.ts | 4 +- src/server/protocol.ts | 3 + src/server/session.ts | 1 + .../unittests/tsserver/externalProjects.ts | 62 +++++++++++++++++++ .../reference/api/tsserverlibrary.d.ts | 2 + 7 files changed, 78 insertions(+), 5 deletions(-) diff --git a/src/harness/client.ts b/src/harness/client.ts index 1c7c0adb834..03d53344616 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -90,7 +90,7 @@ namespace ts.server { return request; } - private processResponse(request: protocol.Request): T { + private processResponse(request: protocol.Request, expectEmptyBody = false): T { let foundResponseMessage = false; let response!: T; while (!foundResponseMessage) { @@ -118,7 +118,8 @@ namespace ts.server { throw new Error("Error " + response.message); } - Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); + Debug.assert(expectEmptyBody || !!response.body, "Malformed response: Unexpected empty response body."); + Debug.assert(!expectEmptyBody || !response.body, "Malformed response: Unexpected non-empty response body."); return response; } @@ -696,7 +697,8 @@ namespace ts.server { } configurePlugin(pluginName: string, configuration: any): void { - this.processRequest("configurePlugin", { pluginName, configuration }); + const request = this.processRequest("configurePlugin", { pluginName, configuration }); + this.processResponse(request, /*expectEmptyBody*/ true); } getIndentationAtPosition(_fileName: string, _position: number, _options: EditorOptions): number { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6c1ad386a05..6bfce902a04 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1607,7 +1607,8 @@ namespace ts.server { this.documentRegistry, compilerOptions, /*lastFileExceededProgramSize*/ this.getFilenameForExceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader), - options.compileOnSave === undefined ? true : options.compileOnSave); + options.compileOnSave === undefined ? true : options.compileOnSave, + /*projectFilePath*/ undefined, this.currentPluginConfigOverrides); project.excludedFiles = excludedFiles; this.addFilesToNonInferredProject(project, files, externalFilePropertyReader, typeAcquisition); diff --git a/src/server/project.ts b/src/server/project.ts index 431c5664f3a..5a2c897e386 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1610,7 +1610,8 @@ namespace ts.server { compilerOptions: CompilerOptions, lastFileExceededProgramSize: string | undefined, public compileOnSaveEnabled: boolean, - projectFilePath?: string) { + projectFilePath?: string, + pluginConfigOverrides?: Map) { super(externalProjectName, ProjectKind.External, projectService, @@ -1621,6 +1622,7 @@ namespace ts.server { compileOnSaveEnabled, projectService.host, getDirectoryPath(projectFilePath || normalizeSlashes(externalProjectName))); + this.enableGlobalPlugins(this.getCompilerOptions(), pluginConfigOverrides); } updateGraph() { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 3b7690e2c60..e5580874369 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1392,6 +1392,9 @@ namespace ts.server.protocol { arguments: ConfigurePluginRequestArguments; } + export interface ConfigurePluginResponse extends Response { + } + /** * Information found in an "open" request. */ diff --git a/src/server/session.ts b/src/server/session.ts index 6cf0619efd1..3c202c9aecd 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2412,6 +2412,7 @@ namespace ts.server { }, [CommandNames.ConfigurePlugin]: (request: protocol.ConfigurePluginRequest) => { this.configurePlugin(request.arguments); + this.doOutput(/*info*/ undefined, CommandNames.ConfigurePlugin, request.seq, /*success*/ true); return this.notRequired(); } }); diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index 82c706500d3..21d1290fc2e 100644 --- a/src/testRunner/unittests/tsserver/externalProjects.ts +++ b/src/testRunner/unittests/tsserver/externalProjects.ts @@ -50,6 +50,68 @@ namespace ts.projectSystem { }); }); + it("load global plugins", () => { + const f1 = { + path: "/a/file1.ts", + content: "let x = [1, 2];" + }; + const p1 = { projectFileName: "/a/proj1.csproj", rootFiles: [toExternalFile(f1.path)], options: {} }; + + const host = createServerHost([f1]); + host.require = (_initialPath, moduleName) => { + assert.equal(moduleName, "myplugin"); + return { + module: () => ({ + create(info: server.PluginCreateInfo) { + const proxy = Harness.LanguageService.makeDefaultProxy(info); + proxy.getSemanticDiagnostics = filename => { + const prev = info.languageService.getSemanticDiagnostics(filename); + const sourceFile: SourceFile = info.project.getSourceFile(toPath(filename, /*basePath*/ undefined, createGetCanonicalFileName(info.serverHost.useCaseSensitiveFileNames)))!; + prev.push({ + category: DiagnosticCategory.Warning, + file: sourceFile, + code: 9999, + length: 3, + messageText: `Plugin diagnostic`, + start: 0 + }); + return prev; + }; + return proxy; + } + }), + error: undefined + }; + }; + const session = createSession(host, { globalPlugins: ["myplugin"] }); + + session.executeCommand({ + seq: 1, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p1] } + }); + + const projectService = session.getProjectService(); + checkNumberOfProjects(projectService, { externalProjects: 1 }); + assert.equal(projectService.externalProjects[0].getProjectName(), p1.projectFileName); + + const handlerResponse = session.executeCommand({ + seq: 2, + type: "request", + command: "semanticDiagnosticsSync", + arguments: { + file: f1.path, + projectFileName: p1.projectFileName + } + }); + + assert.isDefined(handlerResponse.response); + const response = handlerResponse.response as protocol.Diagnostic[]; + assert.equal(response.length, 1); + assert.equal(response[0].text, "Plugin diagnostic"); + }); + it("remove not-listed external projects", () => { const f1 = { path: "/a/app.ts", diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 8208cdba2ab..59fa706bf45 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6748,6 +6748,8 @@ declare namespace ts.server.protocol { command: CommandTypes.ConfigurePlugin; arguments: ConfigurePluginRequestArguments; } + interface ConfigurePluginResponse extends Response { + } /** * Information found in an "open" request. */ From 9475bf7d9e811f0dd05e91f28f321b90a4b3d3a2 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 3 Apr 2019 11:19:23 -0700 Subject: [PATCH 31/48] Fall back from globalReadonlyArrayType to globalArrayType when transpiling --- src/compiler/checker.ts | 2 +- src/testRunner/unittests/services/transpile.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b9e5bcaeddf..3eff7a33747 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -30307,7 +30307,7 @@ namespace ts { autoArrayType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); } - globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray" as __String, /*arity*/ 1); + globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray" as __String, /*arity*/ 1) || globalArrayType; anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; globalThisType = getGlobalTypeOrUndefined("ThisType" as __String, /*arity*/ 1); diff --git a/src/testRunner/unittests/services/transpile.ts b/src/testRunner/unittests/services/transpile.ts index d197d6db621..8429179ffa3 100644 --- a/src/testRunner/unittests/services/transpile.ts +++ b/src/testRunner/unittests/services/transpile.ts @@ -445,5 +445,13 @@ var x = 0;`, { } } }); + + transpilesCorrectly("Supports readonly keyword for arrays", "let x: readonly string[];", { + options: { compilerOptions: { module: ModuleKind.CommonJS } } + }); + + transpilesCorrectly("Supports 'as const' arrays", `([] as const).forEach(k => console.log(k));`, { + options: { compilerOptions: { module: ModuleKind.CommonJS } } + }); }); } From 6c4b5ef8f2f3f8f3d49f9879a8ad4e9b95eed29d Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 3 Apr 2019 11:19:40 -0700 Subject: [PATCH 32/48] Add new baselines --- tests/baselines/reference/transpile/Supports as const arrays.js | 2 ++ .../transpile/Supports as const arrays.oldTranspile.js | 2 ++ .../reference/transpile/Supports readonly keyword for arrays.js | 2 ++ .../Supports readonly keyword for arrays.oldTranspile.js | 2 ++ 4 files changed, 8 insertions(+) create mode 100644 tests/baselines/reference/transpile/Supports as const arrays.js create mode 100644 tests/baselines/reference/transpile/Supports as const arrays.oldTranspile.js create mode 100644 tests/baselines/reference/transpile/Supports readonly keyword for arrays.js create mode 100644 tests/baselines/reference/transpile/Supports readonly keyword for arrays.oldTranspile.js diff --git a/tests/baselines/reference/transpile/Supports as const arrays.js b/tests/baselines/reference/transpile/Supports as const arrays.js new file mode 100644 index 00000000000..aec83eb5ae5 --- /dev/null +++ b/tests/baselines/reference/transpile/Supports as const arrays.js @@ -0,0 +1,2 @@ +[].forEach(function (k) { return console.log(k); }); +//# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Supports as const arrays.oldTranspile.js b/tests/baselines/reference/transpile/Supports as const arrays.oldTranspile.js new file mode 100644 index 00000000000..aec83eb5ae5 --- /dev/null +++ b/tests/baselines/reference/transpile/Supports as const arrays.oldTranspile.js @@ -0,0 +1,2 @@ +[].forEach(function (k) { return console.log(k); }); +//# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Supports readonly keyword for arrays.js b/tests/baselines/reference/transpile/Supports readonly keyword for arrays.js new file mode 100644 index 00000000000..50fa840c62e --- /dev/null +++ b/tests/baselines/reference/transpile/Supports readonly keyword for arrays.js @@ -0,0 +1,2 @@ +var x; +//# sourceMappingURL=file.js.map \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Supports readonly keyword for arrays.oldTranspile.js b/tests/baselines/reference/transpile/Supports readonly keyword for arrays.oldTranspile.js new file mode 100644 index 00000000000..50fa840c62e --- /dev/null +++ b/tests/baselines/reference/transpile/Supports readonly keyword for arrays.oldTranspile.js @@ -0,0 +1,2 @@ +var x; +//# sourceMappingURL=file.js.map \ No newline at end of file From 24b1ec86814a7114e003c95f71ad39bc8fd05e4a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 13:00:47 -0700 Subject: [PATCH 33/48] Update version to '3.5.0'. --- package.json | 2 +- src/compiler/core.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 275411c477f..493a3501d2f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "3.4.0", + "version": "3.5.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ec5eafd6ca3..b99304ddfed 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,7 +1,7 @@ namespace ts { // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configureNightly` too. - export const versionMajorMinor = "3.4"; + export const versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ export const version = `${versionMajorMinor}.0-dev`; } From b8f6ae4e256f2a5f47fe45b7fcfccfec941dc994 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 13:00:58 -0700 Subject: [PATCH 34/48] Accepted baselines. --- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 59fa706bf45..46cd79bf77d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.4"; + const versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ const version: string; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 314ccf298cf..51c10fdf195 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.4"; + const versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ const version: string; } From 7ccd86bf521135626584237d36320f9d963a47cb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 3 Apr 2019 14:05:49 -0700 Subject: [PATCH 35/48] When old program resolved to module and that file is included, dont consider as ambient resolution. Fixes #30422 --- src/compiler/program.ts | 2 +- src/server/project.ts | 3 + .../unittests/tsserver/projectErrors.ts | 84 +++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index ad3121860ad..74bb8e1b1c8 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1134,7 +1134,7 @@ namespace ts { function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName: string): boolean { const resolutionToFile = getResolvedModule(oldSourceFile!, moduleName); const resolvedFile = resolutionToFile && oldProgram!.getSourceFile(resolutionToFile.resolvedFileName); - if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) { + if (resolutionToFile && resolvedFile) { // In the old program, we resolved to an ambient module that was in the same // place as we expected to find an actual module file. // We actually need to return 'false' here even though this seems like a 'true' case diff --git a/src/server/project.ts b/src/server/project.ts index 5a2c897e386..515340c94cc 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -958,6 +958,9 @@ namespace ts.server { ); const elapsed = timestamp() - start; this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram} Elapsed: ${elapsed}ms`); + if (this.program !== oldProgram) { + this.print(); + } return hasNewProgram; } diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 41201c36503..10e6d3b972d 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -479,6 +479,90 @@ namespace ts.projectSystem { session.clearMessages(); } }); + + it("Correct errors when resolution resolves to file that has same ambient module and is also module", () => { + const projectRootPath = "/users/username/projects/myproject"; + const aFile: File = { + path: `${projectRootPath}/src/a.ts`, + content: `import * as myModule from "@custom/plugin"; +function foo() { + // hello +}` + }; + const config: File = { + path: `${projectRootPath}/tsconfig.json`, + content: JSON.stringify({ include: ["src"] }) + }; + const plugin: File = { + path: `${projectRootPath}/node_modules/@custom/plugin/index.d.ts`, + content: `import './proposed'; +declare module '@custom/plugin' { + export const version: string; +}` + }; + const pluginProposed: File = { + path: `${projectRootPath}/node_modules/@custom/plugin/proposed.d.ts`, + content: `declare module '@custom/plugin' { + export const bar = 10; +}` + }; + const files = [libFile, aFile, config, plugin, pluginProposed]; + const host = createServerHost(files); + const session = createSession(host, { canUseEvents: true }); + const service = session.getProjectService(); + openFilesForSession([aFile], session); + + checkNumberOfProjects(service, { configuredProjects: 1 }); + session.clearMessages(); + checkErrors(); + + session.executeCommandSeq({ + command: protocol.CommandTypes.Change, + arguments: { + file: aFile.path, + line: 3, + offset: 8, + endLine: 3, + endOffset: 8, + insertString: "o" + } + }); + checkErrors(); + + function checkErrors() { + host.checkTimeoutQueueLength(0); + const expectedSequenceId = session.getNextSeq(); + session.executeCommandSeq({ + command: server.CommandNames.Geterr, + arguments: { + delay: 0, + files: [aFile.path], + } + }); + + host.checkTimeoutQueueLengthAndRun(1); + + checkErrorMessage(session, "syntaxDiag", { file: aFile.path, diagnostics: [] }, /*isMostRecent*/ true); + session.clearMessages(); + + host.runQueuedImmediateCallbacks(1); + + checkErrorMessage(session, "semanticDiag", { file: aFile.path, diagnostics: [] }); + session.clearMessages(); + + host.runQueuedImmediateCallbacks(1); + + checkErrorMessage(session, "suggestionDiag", { + file: aFile.path, + diagnostics: [ + createDiagnostic({ line: 1, offset: 1 }, { line: 1, offset: 44 }, Diagnostics._0_is_declared_but_its_value_is_never_read, ["myModule"], "suggestion", /*reportsUnnecessary*/ true), + createDiagnostic({ line: 2, offset: 10 }, { line: 2, offset: 13 }, Diagnostics._0_is_declared_but_its_value_is_never_read, ["foo"], "suggestion", /*reportsUnnecessary*/ true) + ], + }); + checkCompleteEvent(session, 2, expectedSequenceId); + session.clearMessages(); + } + }); }); describe("unittests:: tsserver:: Project Errors for Configure file diagnostics events", () => { From 236fed9445d59dfb711016ebd08bf6b431ed506a Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 3 Apr 2019 18:09:33 -0400 Subject: [PATCH 36/48] Fixed post-merge introduced lint errors --- src/compiler/checker.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b12790d542f..e36e1a307c1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19710,12 +19710,6 @@ namespace ts { case SyntaxKind.ExpressionWithTypeArguments: case SyntaxKind.HeritageClause: return false; - case SyntaxKind.ExpressionWithTypeArguments: - case SyntaxKind.HeritageClause: - case SyntaxKind.ComputedPropertyName: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - return false; default: return isExpressionNode(node) ? false : "quit"; } From 13d2b8d617b820e40a93cabc9f2a31895b19d32b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 22 Mar 2019 15:44:29 -0700 Subject: [PATCH 37/48] Add the Omit helper type. --- src/lib/es5.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 458dc8b9252..79fd72ac937 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1443,6 +1443,11 @@ type Exclude = T extends U ? never : T; */ type Extract = T extends U ? T : never; +/** + * Construct a type with the properties of T except for those in type K. + */ +type Omit = Pick>; + /** * Exclude null and undefined from T */ From 1dae8fcc305c173082eb83a66b726f154c06a278 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 14:01:05 -0700 Subject: [PATCH 38/48] Fix tests to be non-global. --- .../compiler/circularlySimplifyingConditionalTypesNoCrash.ts | 4 +++- tests/cases/compiler/indexedAccessRetainsIndexSignature.ts | 2 +- .../reactReduxLikeDeferredInferenceAllowsAssignment.ts | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts b/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts index ccacb10dd2d..34e5a1b0f4c 100644 --- a/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts +++ b/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts @@ -45,4 +45,6 @@ const myStoreConnect: Connect = function( mergeProps, options, ); -}; \ No newline at end of file +}; + +export {}; diff --git a/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts b/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts index 11abf771edc..36b7c482506 100644 --- a/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts +++ b/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts @@ -7,4 +7,4 @@ type Omit1 = Pick>; type Omit2 = {[P in Diff]: T[P]}; type O = Omit<{ a: number, b: string }, 'a'> -const o: O = { b: '' } +export const o: O = { b: '' } diff --git a/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts b/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts index 940031c52c2..20b18febdc3 100644 --- a/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts +++ b/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts @@ -143,3 +143,5 @@ const Test1 = connect( null, mapDispatchToProps )(TestComponent); + +export {}; From e8feaf9a3eeb691a2fdf209a5ec3c3f75d553a78 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 17:09:37 -0700 Subject: [PATCH 39/48] Accepted baselines. --- .../circularlySimplifyingConditionalTypesNoCrash.js | 6 +++++- .../circularlySimplifyingConditionalTypesNoCrash.symbols | 3 +++ .../circularlySimplifyingConditionalTypesNoCrash.types | 3 +++ .../reference/indexedAccessRetainsIndexSignature.js | 6 ++++-- .../reference/indexedAccessRetainsIndexSignature.symbols | 6 +++--- .../reference/indexedAccessRetainsIndexSignature.types | 2 +- .../reactReduxLikeDeferredInferenceAllowsAssignment.js | 3 +++ .../reactReduxLikeDeferredInferenceAllowsAssignment.symbols | 2 ++ .../reactReduxLikeDeferredInferenceAllowsAssignment.types | 2 ++ 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js index 724a8f8dbea..fdeff927f6b 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js @@ -45,10 +45,14 @@ const myStoreConnect: Connect = function( mergeProps, options, ); -}; +}; + +export {}; + //// [circularlySimplifyingConditionalTypesNoCrash.js] "use strict"; +exports.__esModule = true; var myStoreConnect = function (mapStateToProps, mapDispatchToProps, mergeProps, options) { if (options === void 0) { options = {}; } return connect(mapStateToProps, mapDispatchToProps, mergeProps, options); diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols index 97abdadf2b3..9b7f5dd22ca 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols @@ -152,3 +152,6 @@ const myStoreConnect: Connect = function( ); }; + +export {}; + diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types index 4a3a1fdbe53..e7690eee850 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types @@ -90,3 +90,6 @@ const myStoreConnect: Connect = function( ); }; + +export {}; + diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.js b/tests/baselines/reference/indexedAccessRetainsIndexSignature.js index 92952515779..7d16717bae9 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.js +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.js @@ -8,8 +8,10 @@ type Omit1 = Pick>; type Omit2 = {[P in Diff]: T[P]}; type O = Omit<{ a: number, b: string }, 'a'> -const o: O = { b: '' } +export const o: O = { b: '' } //// [indexedAccessRetainsIndexSignature.js] -var o = { b: '' }; +"use strict"; +exports.__esModule = true; +exports.o = { b: '' }; diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols b/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols index f6d65f9cf6f..94b8fcd070f 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols @@ -55,8 +55,8 @@ type O = Omit<{ a: number, b: string }, 'a'> >a : Symbol(a, Decl(indexedAccessRetainsIndexSignature.ts, 8, 15)) >b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 8, 26)) -const o: O = { b: '' } ->o : Symbol(o, Decl(indexedAccessRetainsIndexSignature.ts, 9, 5)) +export const o: O = { b: '' } +>o : Symbol(o, Decl(indexedAccessRetainsIndexSignature.ts, 9, 12)) >O : Symbol(O, Decl(indexedAccessRetainsIndexSignature.ts, 6, 67)) ->b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 9, 14)) +>b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 9, 21)) diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.types b/tests/baselines/reference/indexedAccessRetainsIndexSignature.types index 2f79f6f8498..5e92e67279d 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.types +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.types @@ -21,7 +21,7 @@ type O = Omit<{ a: number, b: string }, 'a'> >a : number >b : string -const o: O = { b: '' } +export const o: O = { b: '' } >o : Pick<{ a: number; b: string; }, "b"> >{ b: '' } : { b: string; } >b : string diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js index 2eeda64fc98..69e1108ad30 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js @@ -143,6 +143,8 @@ const Test1 = connect( null, mapDispatchToProps )(TestComponent); + +export {}; //// [reactReduxLikeDeferredInferenceAllowsAssignment.js] @@ -196,6 +198,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; var _this = this; +exports.__esModule = true; var simpleAction = function (payload) { return ({ type: "SIMPLE_ACTION", payload: payload diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols index ec954dfde79..85daf38368a 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols @@ -469,3 +469,5 @@ const Test1 = connect( )(TestComponent); >TestComponent : Symbol(TestComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 134, 1)) +export {}; + diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types index 767d94535cb..4772a806521 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types @@ -286,3 +286,5 @@ const Test1 = connect( )(TestComponent); >TestComponent : typeof TestComponent +export {}; + From 71af02f7459dc812e85ac31365bfe23daf14b4e4 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 4 Apr 2019 10:16:43 -0700 Subject: [PATCH 40/48] Updated annoying 'globalTypes' list. --- src/harness/fourslash.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 089a2630dd8..9e117cdfd8f 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -4507,6 +4507,7 @@ namespace FourSlashInterface { typeEntry("Record"), typeEntry("Exclude"), typeEntry("Extract"), + typeEntry("Omit"), typeEntry("NonNullable"), typeEntry("Parameters"), typeEntry("ConstructorParameters"), From 762a557fccd06aea3c6485828833fe9c3d2c5543 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 4 Apr 2019 11:37:15 -0700 Subject: [PATCH 41/48] Update TypeScript-React-Native-Starter Add a 'path' field to test.json. --- src/testRunner/externalCompileRunner.ts | 3 ++- .../reference/user/TypeScript-React-Native-Starter.log | 8 ++++---- .../cases/user/TypeScript-React-Native-Starter/test.json | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index a8a240a5161..c3b2ef3e6ec 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -10,6 +10,7 @@ interface ExecResult { interface UserConfig { types: string[]; + path?: string; } abstract class ExternalCompileRunnerBase extends RunnerBase { @@ -57,7 +58,7 @@ abstract class ExternalCompileRunnerBase extends RunnerBase { ts.Debug.assert(!!config.types, "Bad format from test.json: Types field must be present."); types = config.types; - cwd = submoduleDir; + cwd = config.path ? path.join(cwd, config.path) : submoduleDir; } if (fs.existsSync(path.join(cwd, "package.json"))) { if (fs.existsSync(path.join(cwd, "package-lock.json"))) { diff --git a/tests/baselines/reference/user/TypeScript-React-Native-Starter.log b/tests/baselines/reference/user/TypeScript-React-Native-Starter.log index 91ac9569693..a678ef73eb7 100644 --- a/tests/baselines/reference/user/TypeScript-React-Native-Starter.log +++ b/tests/baselines/reference/user/TypeScript-React-Native-Starter.log @@ -1,9 +1,9 @@ Exit Code: 1 Standard output: -node_modules/@types/node/globals.d.ts(163,13): error TS2451: Cannot redeclare block-scoped variable 'global'. -node_modules/@types/node/globals.d.ts(217,13): error TS2300: Duplicate identifier 'require'. -node_modules/@types/react-native/index.d.ts(8958,11): error TS2451: Cannot redeclare block-scoped variable 'global'. -node_modules/@types/react-native/index.d.ts(8959,14): error TS2300: Duplicate identifier 'require'. +node_modules/@types/react-native/index.d.ts(3425,42): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +node_modules/@types/react-native/index.d.ts(3438,42): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. +node_modules/@types/react-native/index.d.ts(8745,18): error TS2717: Subsequent property declarations must have the same type. Property 'geolocation' must be of type 'Geolocation', but here has type 'GeolocationStatic'. +node_modules/@types/react/index.d.ts(379,23): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later. diff --git a/tests/cases/user/TypeScript-React-Native-Starter/test.json b/tests/cases/user/TypeScript-React-Native-Starter/test.json index 8b177c575aa..cbe38c569ee 100644 --- a/tests/cases/user/TypeScript-React-Native-Starter/test.json +++ b/tests/cases/user/TypeScript-React-Native-Starter/test.json @@ -1,3 +1,4 @@ { - "types": ["jest"] + "types": ["jest"], + "path": "TypeScript-React-Native-Starter/ExampleProject" } From 0c832f258d47f45cb3f0eec26c9bd88192eb18b9 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 4 Apr 2019 15:04:11 -0400 Subject: [PATCH 42/48] Updated baselines again --- .../baselines/reference/classUsedBeforeInitializedVariables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/baselines/reference/classUsedBeforeInitializedVariables.js b/tests/baselines/reference/classUsedBeforeInitializedVariables.js index 4442c7193d6..3a3591cfdad 100644 --- a/tests/baselines/reference/classUsedBeforeInitializedVariables.js +++ b/tests/baselines/reference/classUsedBeforeInitializedVariables.js @@ -55,8 +55,8 @@ var __extends = (this && this.__extends) || (function () { })(); var Test = /** @class */ (function () { function Test() { - var _this = this; var _a, _b, _c; + var _this = this; this.p1 = 0; this.p2 = this.p1; this.p3 = this.p4; From 16450a027ad7049f226d38ea7a0d8c2e9e5a320d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 4 Apr 2019 12:25:15 -0700 Subject: [PATCH 43/48] Change the default type parameter constraints and defaults to unknown from {} (#30637) * Change the default type parameter constraint and default to unknown from {} * Relax unknown checking outside of strictNullChecks a bit * Increase strictness on index signatures with type `unknown` so inference doesnt change surprisingly * Remove redundant switch --- src/compiler/checker.ts | 45 ++-- ...onWithIncorrectNumberOfTypeArguments.types | 24 +- ...GenericFunctionWithZeroTypeArguments.types | 12 +- ...nalNoInfiniteInstantiationDepth.errors.txt | 144 +++++++++++ ...lySimplifyingConditionalTypesNoCrash.types | 4 +- .../classWithBaseClassButNoConstructor.types | 12 +- .../reference/classWithConstructors.types | 12 +- .../classWithNoConstructorOrBaseClass.types | 4 +- .../reference/conditionalTypes1.types | 4 +- .../constraintSatisfactionWithAny2.types | 2 +- .../contextualSignatureInstantiation2.types | 6 +- ...ypingTwoInstancesOfSameTypeParameter.types | 14 +- .../defaultExportInAwaitExpression01.types | 20 +- .../defaultExportInAwaitExpression02.types | 20 +- ...AnnotationAndInvalidInitializer.errors.txt | 8 +- ...eWithAnnotationAndInvalidInitializer.types | 4 +- .../externalModuleExportingGenericClass.types | 8 +- ...ionTypeArgumentAssignmentCompat.errors.txt | 4 +- .../genericCallTypeArgumentInference.types | 28 +-- ...lWithConstructorTypedArguments5.errors.txt | 8 +- ...enericCallWithFunctionTypedArguments.types | 12 +- ...nericCallWithFunctionTypedArguments2.types | 24 +- ...CallWithFunctionTypedArguments5.errors.txt | 6 +- ...ricCallWithGenericSignatureArguments.types | 44 ++-- ...hOverloadedConstructorTypedArguments.types | 20 +- ...oadedConstructorTypedArguments2.errors.txt | 4 +- ...OverloadedConstructorTypedArguments2.types | 12 +- ...WithOverloadedFunctionTypedArguments.types | 20 +- ...erloadedFunctionTypedArguments2.errors.txt | 4 +- ...ithOverloadedFunctionTypedArguments2.types | 12 +- ...lassWithFunctionTypedMemberArguments.types | 12 +- ...enericConstructExpressionWithoutArgs.types | 4 +- tests/baselines/reference/genericDefaults.js | 2 +- .../baselines/reference/genericDefaults.types | 44 ++-- ...CallSignatureReturnTypeMismatch.errors.txt | 4 +- .../reference/genericFunctionInference1.types | 6 +- .../reference/genericFunctionParameters.js | 4 +- .../reference/genericFunctionParameters.types | 8 +- ...ericFunctionsWithOptionalParameters1.types | 8 +- ...ericFunctionsWithOptionalParameters2.types | 6 +- ...genericObjectCreationWithoutTypeArgs.types | 8 +- .../genericRestParameters3.errors.txt | 24 +- .../getAndSetNotIdenticalType2.types | 22 +- .../getAndSetNotIdenticalType3.types | 8 +- .../reference/implicitAnyGenerics.types | 6 +- ...nownStillRequiresIndexSignature.errors.txt | 18 ++ ...fTypeUnknownStillRequiresIndexSignature.js | 19 ++ ...UnknownStillRequiresIndexSignature.symbols | 30 +++ ...peUnknownStillRequiresIndexSignature.types | 38 +++ .../indexSignatureTypeInference.errors.txt | 4 +- .../indexerReturningTypeParameter1.types | 8 +- tests/baselines/reference/inferTypes1.types | 4 +- .../baselines/reference/inferenceLimit.types | 22 +- .../inferentialTypingUsingApparentType3.types | 6 +- ...inferentialTypingWithFunctionTypeZip.types | 8 +- ...heritanceOfGenericConstructorMethod1.types | 4 +- ...heritanceOfGenericConstructorMethod2.types | 4 +- ...ateGenericClassWithZeroTypeArguments.types | 8 +- .../reference/jsxInExtendsClause.types | 2 +- .../reference/keyofAndIndexedAccess.js | 6 +- .../reference/keyofAndIndexedAccess.types | 14 +- .../mappedTypeInferenceErrors.errors.txt | 6 +- .../mappedTypeRecursiveInference.errors.txt | 8 +- ...eLibrary_NoErrorDuplicateLibOptions1.types | 16 +- ...eLibrary_NoErrorDuplicateLibOptions2.types | 16 +- ...dularizeLibrary_TargetES5UsingES6Lib.types | 16 +- .../mutuallyRecursiveCallbacks.errors.txt | 8 +- ...wingGenericTypeFromInstanceof01.errors.txt | 8 +- .../reference/newOperatorConformance.types | 6 +- .../reference/newOperatorErrorCases.types | 6 +- .../objectLiteralContextualTyping.errors.txt | 36 +++ .../objectLiteralContextualTyping.types | 6 +- .../overloadResolutionClassConstructors.types | 6 +- .../parameterReferenceInInitializer1.types | 4 +- ...ivacyCheckAnonymousFunctionParameter.types | 8 +- ...vacyCheckAnonymousFunctionParameter2.types | 2 +- .../reference/promisePermutations.types | 112 ++++----- .../reference/promisePermutations2.types | 112 ++++----- .../reference/promisePermutations3.errors.txt | 8 +- .../reference/promisePermutations3.types | 108 ++++----- ...essOnTypeParameterWithoutConstraints.types | 4 +- ...ferredInferenceAllowsAssignment.errors.txt | 225 ++++++++++++++++++ .../reference/recursiveBaseCheck3.errors.txt | 4 +- .../reference/recursiveBaseCheck3.types | 4 +- .../reference/recursiveBaseCheck4.errors.txt | 4 +- .../reference/recursiveBaseCheck4.types | 4 +- .../reference/recursiveBaseCheck5.errors.txt | 4 +- .../reference/recursiveBaseCheck5.types | 4 +- .../reference/recursiveBaseCheck6.errors.txt | 4 +- .../reference/recursiveBaseCheck6.types | 4 +- .../reference/restTupleElements1.errors.txt | 8 +- .../returnTypeParameterWithModules.types | 2 +- ...TemplateStringsTypeArgumentInference.types | 72 +++--- ...plateStringsTypeArgumentInferenceES6.types | 72 +++--- .../tsxElementResolution12.errors.txt | 7 +- ...ionComponentsWithTypeArguments2.errors.txt | 8 +- ...ionComponentsWithTypeArguments4.errors.txt | 12 +- .../reference/tsxTypeErrors.errors.txt | 46 ---- tests/baselines/reference/tsxTypeErrors.types | 24 +- .../reference/tupleTypeInference2.types | 4 +- .../reference/typeArgumentInference.types | 36 +-- ...ArgumentInferenceConstructSignatures.types | 36 +-- ...ntInferenceWithClassExpression2.errors.txt | 4 +- ...typeArgumentInferenceWithConstraints.types | 12 +- .../reference/typeInferenceFixEarly.types | 6 +- .../reference/typeOfThisInStaticMembers.types | 4 +- .../reference/underscoreTest1.errors.txt | 4 +- .../baselines/reference/underscoreTest1.types | 8 +- .../reference/unknownType1.errors.txt | 11 +- tests/baselines/reference/unknownType1.js | 8 +- .../baselines/reference/unknownType1.symbols | 4 +- tests/baselines/reference/unknownType1.types | 4 +- .../useObjectValuesAndEntries1.types | 8 +- .../reference/usePromiseFinally.types | 14 +- ...fTypeUnknownStillRequiresIndexSignature.ts | 9 + .../conformance/types/unknown/unknownType1.ts | 4 +- .../fourslash/automaticConstructorToggling.ts | 4 +- tests/cases/fourslash/constructorQuickInfo.ts | 4 +- tests/cases/fourslash/genericCombinators2.ts | 4 +- ...genericDerivedTypeAcrossModuleBoundary1.ts | 2 +- .../genericFunctionSignatureHelp1.ts | 2 +- .../genericFunctionSignatureHelp2.ts | 2 +- .../genericFunctionSignatureHelp3.ts | 10 +- .../genericFunctionSignatureHelp3MultiFile.ts | 10 +- ...ParametershasInstantiatedSignatureHelp.tsx | 2 +- ...Info_errorSignatureFillsInTypeParameter.ts | 2 +- .../shims-pp/getQuickInfoAtPosition.ts | 4 +- .../fourslash/shims/getQuickInfoAtPosition.ts | 4 +- .../signatureHelpExplicitTypeArguments.ts | 4 +- .../signatureHelpInCompleteGenericsCall.ts | 2 +- .../signatureHelpOnTypePredicates.ts | 2 +- .../fourslash/signatureHelpWithTriggers02.ts | 2 +- .../fourslash/staticGenericOverloads1.ts | 2 +- 133 files changed, 1309 insertions(+), 835 deletions(-) create mode 100644 tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt create mode 100644 tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.errors.txt create mode 100644 tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.js create mode 100644 tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.symbols create mode 100644 tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.types create mode 100644 tests/baselines/reference/objectLiteralContextualTyping.errors.txt create mode 100644 tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt delete mode 100644 tests/baselines/reference/tsxTypeErrors.errors.txt create mode 100644 tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3eff7a33747..698d75b340b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7330,7 +7330,7 @@ namespace ts { const declaredType = getTypeFromMappedTypeNode(type.declaration); const constraint = getConstraintTypeFromMappedType(declaredType); const extendedConstraint = constraint && constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint && extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType; + type.modifiersType = extendedConstraint && extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : unknownType; } } return type.modifiersType; @@ -7773,7 +7773,7 @@ namespace ts { * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type: Type): Type { - const t = type.flags & TypeFlags.Instantiable ? getBaseConstraintOfType(type) || emptyObjectType : type; + const t = type.flags & TypeFlags.Instantiable ? getBaseConstraintOfType(type) || unknownType : type; return getObjectFlags(t) & ObjectFlags.Mapped ? getApparentTypeOfMappedType(t) : t.flags & TypeFlags.Intersection ? getApparentTypeOfIntersectionType(t) : t.flags & TypeFlags.StringLike ? globalStringType : @@ -7783,6 +7783,7 @@ namespace ts { t.flags & TypeFlags.ESSymbolLike ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) : t.flags & TypeFlags.NonPrimitive ? emptyObjectType : t.flags & TypeFlags.Index ? keyofConstraintType : + t.flags & TypeFlags.Unknown && !strictNullChecks ? emptyObjectType : t; } @@ -8106,7 +8107,7 @@ namespace ts { const baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny); for (let i = numTypeArguments; i < numTypeParameters; i++) { let defaultType = getDefaultFromTypeParameter(typeParameters![i]); - if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) { + if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) { defaultType = anyType; } result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters!, result)) : baseDefaultType; @@ -8485,7 +8486,7 @@ namespace ts { const typeParameters = signature.typeParameters; if (typeParameters) { const typeEraser = createTypeEraser(typeParameters); - const baseConstraints = map(typeParameters, tp => instantiateType(getBaseConstraintOfType(tp), typeEraser) || emptyObjectType); + const baseConstraints = map(typeParameters, tp => instantiateType(getBaseConstraintOfType(tp), typeEraser) || unknownType); return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), /*eraseTypeParameters*/ true); } return signature; @@ -10799,7 +10800,7 @@ namespace ts { * This is used during inference when instantiating type parameter defaults. */ function createBackreferenceMapper(context: InferenceContext, index: number): TypeMapper { - return t => findIndex(context.inferences, info => info.typeParameter === t) >= index ? emptyObjectType : t; + return t => findIndex(context.inferences, info => info.typeParameter === t) >= index ? unknownType : t; } function combineTypeMappers(mapper1: TypeMapper | undefined, mapper2: TypeMapper): TypeMapper; @@ -11346,7 +11347,7 @@ namespace ts { function isTypeDerivedFrom(source: Type, target: Type): boolean { return source.flags & TypeFlags.Union ? every((source).types, t => isTypeDerivedFrom(t, target)) : target.flags & TypeFlags.Union ? some((target).types, t => isTypeDerivedFrom(source, t)) : - source.flags & TypeFlags.InstantiableNonPrimitive ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) : + source.flags & TypeFlags.InstantiableNonPrimitive ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (TypeFlags.Object | TypeFlags.NonPrimitive)) : target === globalFunctionType ? !!(source.flags & TypeFlags.Object) && isFunctionObjectType(source as ObjectType) : hasBaseType(source, getTargetType(target)); @@ -13349,7 +13350,7 @@ namespace ts { return indexTypesIdenticalTo(source, target, kind); } const targetInfo = getIndexInfoOfType(target, kind); - if (!targetInfo || targetInfo.type.flags & TypeFlags.AnyOrUnknown && !sourceIsPrimitive) { + if (!targetInfo || targetInfo.type.flags & TypeFlags.Any && !sourceIsPrimitive) { // Index signature of type any permits assignment from everything but primitives return Ternary.True; } @@ -14500,7 +14501,7 @@ namespace ts { const templateType = getTemplateTypeFromMappedType(target); const inference = createInferenceInfo(typeParameter); inferTypes([inference], sourceType, templateType); - return getTypeFromInference(inference) || emptyObjectType; + return getTypeFromInference(inference) || unknownType; } function* getUnmatchedProperties(source: Type, target: Type, requireOptionalProperties: boolean, matchDiscriminantProperties: boolean) { @@ -15099,7 +15100,7 @@ namespace ts { } function getDefaultTypeArgumentType(isInJavaScriptFile: boolean): Type { - return isInJavaScriptFile ? anyType : emptyObjectType; + return isInJavaScriptFile ? anyType : unknownType; } function getInferredTypes(context: InferenceContext): Type[] { @@ -15443,7 +15444,7 @@ namespace ts { return strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts; } if (flags & TypeFlags.Instantiable) { - return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType); + return getTypeFacts(getBaseConstraintOfType(type) || unknownType); } if (flags & TypeFlags.UnionOrIntersection) { return getTypeFactsOfTypes((type).types); @@ -16754,7 +16755,7 @@ namespace ts { } function typeHasNullableConstraint(type: Type) { - return type.flags & TypeFlags.InstantiableNonPrimitive && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, TypeFlags.Nullable); + return type.flags & TypeFlags.InstantiableNonPrimitive && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, TypeFlags.Nullable); } function getConstraintForLocation(type: Type, node: Node): Type; @@ -18204,7 +18205,7 @@ namespace ts { } function getJsxPropsTypeFromCallSignature(sig: Signature, context: JsxOpeningLikeElement) { - let propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType); + let propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType); propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType); const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (intrinsicAttribs !== errorType) { @@ -18278,7 +18279,7 @@ namespace ts { const forcedLookupLocation = getJsxElementPropertiesName(ns); let attributesType = forcedLookupLocation === undefined // If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type - ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType) + ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType) : forcedLookupLocation === "" // If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead ? getReturnTypeOfSignature(sig) @@ -18290,7 +18291,7 @@ namespace ts { if (!!forcedLookupLocation && !!length(context.attributes.properties)) { error(context, Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, unescapeLeadingUnderscores(forcedLookupLocation)); } - return emptyObjectType; + return unknownType; } attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType); @@ -19501,7 +19502,7 @@ namespace ts { undefinedDiagnostic?: DiagnosticMessage, nullOrUndefinedDiagnostic?: DiagnosticMessage ): Type { - if (type.flags & TypeFlags.Unknown) { + if (strictNullChecks && type.flags & TypeFlags.Unknown) { error(node, Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -22000,7 +22001,7 @@ namespace ts { const decl = parameter.valueDeclaration as ParameterDeclaration; if (decl.name.kind !== SyntaxKind.Identifier) { // if inference didn't come up with anything but {}, fall back to the binding pattern if present. - if (links.type === emptyObjectType) { + if (links.type === unknownType) { links.type = getTypeFromBindingPattern(decl.name); } assignBindingElementTypes(decl.name); @@ -22013,11 +22014,11 @@ namespace ts { const globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true); if (globalPromiseType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type - promisedType = getAwaitedType(promisedType) || emptyObjectType; + promisedType = getAwaitedType(promisedType) || unknownType; return createTypeReference(globalPromiseType, [promisedType]); } - return emptyObjectType; + return unknownType; } function createPromiseLikeType(promisedType: Type): Type { @@ -22025,16 +22026,16 @@ namespace ts { const globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true); if (globalPromiseLikeType !== emptyGenericType) { // if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type - promisedType = getAwaitedType(promisedType) || emptyObjectType; + promisedType = getAwaitedType(promisedType) || unknownType; return createTypeReference(globalPromiseLikeType, [promisedType]); } - return emptyObjectType; + return unknownType; } function createPromiseReturnType(func: FunctionLikeDeclaration | ImportCall, promisedType: Type) { const promiseType = createPromiseType(promisedType); - if (promiseType === emptyObjectType) { + if (promiseType === unknownType) { error(func, isImportCall(func) ? Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option : Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); @@ -23467,7 +23468,7 @@ namespace ts { // If the contextual type is a type variable constrained to a primitive type, consider // this a literal context for literals of that primitive type. For example, given a // type parameter 'T extends string', infer string literal types for T. - const constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; + const constraint = getBaseConstraintOfType(contextualType) || unknownType; return maybeTypeOfKind(constraint, TypeFlags.String) && maybeTypeOfKind(candidateType, TypeFlags.StringLiteral) || maybeTypeOfKind(constraint, TypeFlags.Number) && maybeTypeOfKind(candidateType, TypeFlags.NumberLiteral) || maybeTypeOfKind(constraint, TypeFlags.BigInt) && maybeTypeOfKind(candidateType, TypeFlags.BigIntLiteral) || diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types index 992b8f30ba3..9d5d0e19ebb 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types @@ -136,24 +136,24 @@ class C2 { } } var r6 = (new C2()).f(1, ''); ->r6 : {} ->(new C2()).f(1, '') : {} ->(new C2()).f : (x: {}, y: {}) => {} ->(new C2()) : C2<{}, {}> ->new C2() : C2<{}, {}> +>r6 : unknown +>(new C2()).f(1, '') : unknown +>(new C2()).f : (x: unknown, y: unknown) => unknown +>(new C2()) : C2 +>new C2() : C2 >C2 : typeof C2 ->f : (x: {}, y: {}) => {} +>f : (x: unknown, y: unknown) => unknown >1 : 1 >'' : "" var r6b = (new C2()).f(1, ''); ->r6b : {} ->(new C2()).f(1, '') : {} ->(new C2()).f : (x: {}, y: {}) => {} ->(new C2()) : C2<{}, {}> ->new C2() : C2<{}, {}> +>r6b : unknown +>(new C2()).f(1, '') : unknown +>(new C2()).f : (x: unknown, y: unknown) => unknown +>(new C2()) : C2 +>new C2() : C2 >C2 : typeof C2 ->f : (x: {}, y: {}) => {} +>f : (x: unknown, y: unknown) => unknown >1 : 1 >'' : "" diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types index 63798c4225d..2828694d9fa 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.types @@ -83,13 +83,13 @@ class C2 { } } var r6 = (new C2()).f(1); ->r6 : {} ->(new C2()).f(1) : {} ->(new C2()).f : (x: {}) => {} ->(new C2()) : C2<{}> ->new C2() : C2<{}> +>r6 : unknown +>(new C2()).f(1) : unknown +>(new C2()).f : (x: unknown) => unknown +>(new C2()) : C2 +>new C2() : C2 >C2 : typeof C2 ->f : (x: {}) => {} +>f : (x: unknown) => unknown >1 : 1 interface I2 { diff --git a/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt new file mode 100644 index 00000000000..69ea8e1afd2 --- /dev/null +++ b/tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt @@ -0,0 +1,144 @@ +tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts(63,84): error TS2344: Type 'GetProps' does not satisfy the constraint 'Shared>'. + Type 'unknown' is not assignable to type 'Shared>'. + Type 'Matching>' is not assignable to type 'Shared>'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[P] | (TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>] | (TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]) | GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] | GetProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string] | GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + + +==== tests/cases/compiler/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.ts (1 errors) ==== + declare class Component

{ + constructor(props: Readonly

); + constructor(props: P, context?: any); + readonly props: Readonly

& Readonly<{ children?: {} }>; + } + interface ComponentClass

{ + new (props: P, context?: any): Component

; + propTypes?: WeakValidationMap

; + defaultProps?: Partial

; + displayName?: string; + } + interface FunctionComponent

{ + (props: P & { children?: {} }, context?: any): {} | null; + propTypes?: WeakValidationMap

; + defaultProps?: Partial

; + displayName?: string; + } + + export declare const nominalTypeHack: unique symbol; + export interface Validator { + (props: object, propName: string, componentName: string, location: string, propFullName: string): Error | null; + [nominalTypeHack]?: T; + } + type WeakValidationMap = { + [K in keyof T]?: null extends T[K] + ? Validator + : undefined extends T[K] + ? Validator + : Validator + }; + type ComponentType

= ComponentClass

| FunctionComponent

; + + export type Shared< + InjectedProps, + DecorationTargetProps extends Shared + > = { + [P in Extract]?: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never; + }; + + // Infers prop type from component C + export type GetProps = C extends ComponentType ? P : never; + + export type ConnectedComponentClass< + C extends ComponentType, + P + > = ComponentClass

& { + WrappedComponent: C; + }; + + export type Matching = { + [P in keyof DecorationTargetProps]: P extends keyof InjectedProps + ? InjectedProps[P] extends DecorationTargetProps[P] + ? DecorationTargetProps[P] + : InjectedProps[P] + : DecorationTargetProps[P]; + }; + + export type Omit = Pick>; + + export type InferableComponentEnhancerWithProps = + >>>( + component: C + ) => ConnectedComponentClass, keyof Shared>> & TNeedsProps>; + ~~~~~~~~~~~ +!!! error TS2344: Type 'GetProps' does not satisfy the constraint 'Shared>'. +!!! error TS2344: Type 'unknown' is not assignable to type 'Shared>'. +!!! error TS2344: Type 'Matching>' is not assignable to type 'Shared>'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[P] | (TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]) | GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] | GetProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] | GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + \ No newline at end of file diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types index e7690eee850..dc086cdf87c 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types @@ -56,7 +56,7 @@ declare var connect: Connect; const myStoreConnect: Connect = function( >myStoreConnect : Connect ->function( mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options: unknown = {},) { return connect( mapStateToProps, mapDispatchToProps, mergeProps, options, );} : (mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options?: unknown) => InferableComponentEnhancerWithProps<{}, {}> +>function( mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options: unknown = {},) { return connect( mapStateToProps, mapDispatchToProps, mergeProps, options, );} : (mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options?: unknown) => InferableComponentEnhancerWithProps mapStateToProps?: any, >mapStateToProps : any @@ -73,7 +73,7 @@ const myStoreConnect: Connect = function( ) { return connect( ->connect( mapStateToProps, mapDispatchToProps, mergeProps, options, ) : InferableComponentEnhancerWithProps<{}, {}> +>connect( mapStateToProps, mapDispatchToProps, mergeProps, options, ) : InferableComponentEnhancerWithProps >connect : Connect mapStateToProps, diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.types b/tests/baselines/reference/classWithBaseClassButNoConstructor.types index 416e195f5b2..1b8aa288184 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.types +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.types @@ -54,8 +54,8 @@ var d = new D(); // error >D : typeof D var d2 = new D(1); // ok ->d2 : D ->new D(1) : D +>d2 : D +>new D(1) : D >D : typeof D >1 : 1 @@ -78,8 +78,8 @@ var d3 = new D(); // error >D : typeof D var d4 = new D(1); // ok ->d4 : D ->new D(1) : D +>d4 : D +>new D(1) : D >D : typeof D >1 : 1 @@ -101,8 +101,8 @@ var d5 = new D(); // error >D : typeof D var d6 = new D(1); // ok ->d6 : D ->new D(1) : D +>d6 : D +>new D(1) : D >D : typeof D >1 : 1 diff --git a/tests/baselines/reference/classWithConstructors.types b/tests/baselines/reference/classWithConstructors.types index db2d88969bf..07a5be543eb 100644 --- a/tests/baselines/reference/classWithConstructors.types +++ b/tests/baselines/reference/classWithConstructors.types @@ -113,8 +113,8 @@ module Generics { >C2 : typeof C2 var c4 = new C2(''); // ok ->c4 : C2 ->new C2('') : C2 +>c4 : C2 +>new C2('') : C2 >C2 : typeof C2 >'' : "" @@ -135,14 +135,14 @@ module Generics { >D : typeof D var d2 = new D(1); // ok ->d2 : D ->new D(1) : D +>d2 : D +>new D(1) : D >D : typeof D >1 : 1 var d3 = new D(''); // ok ->d3 : D ->new D('') : D +>d3 : D +>new D('') : D >D : typeof D >'' : "" } diff --git a/tests/baselines/reference/classWithNoConstructorOrBaseClass.types b/tests/baselines/reference/classWithNoConstructorOrBaseClass.types index 21b0642652c..6ad0a5357b2 100644 --- a/tests/baselines/reference/classWithNoConstructorOrBaseClass.types +++ b/tests/baselines/reference/classWithNoConstructorOrBaseClass.types @@ -26,8 +26,8 @@ class D { } var d = new D(); ->d : D<{}, {}> ->new D() : D<{}, {}> +>d : D +>new D() : D >D : typeof D var d2 = new D(); diff --git a/tests/baselines/reference/conditionalTypes1.types b/tests/baselines/reference/conditionalTypes1.types index 125324d60d4..bc70e68f0ca 100644 --- a/tests/baselines/reference/conditionalTypes1.types +++ b/tests/baselines/reference/conditionalTypes1.types @@ -673,8 +673,8 @@ function f22(x: T extends (infer U)[] ? U[] : never) { >x : T extends (infer U)[] ? U[] : never let e = x[0]; // {} ->e : {} ->x[0] : {} +>e : unknown +>x[0] : unknown >x : T extends (infer U)[] ? U[] : never >0 : 0 } diff --git a/tests/baselines/reference/constraintSatisfactionWithAny2.types b/tests/baselines/reference/constraintSatisfactionWithAny2.types index 78505b6bbb8..751f88b81eb 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny2.types +++ b/tests/baselines/reference/constraintSatisfactionWithAny2.types @@ -11,7 +11,7 @@ var a: any; >a : any foo(a); ->foo(a) : {} +>foo(a) : unknown >foo : (x: U) => Z>(y: T) => Z >a : any diff --git a/tests/baselines/reference/contextualSignatureInstantiation2.types b/tests/baselines/reference/contextualSignatureInstantiation2.types index 44776b5c01e..1b97094ed4a 100644 --- a/tests/baselines/reference/contextualSignatureInstantiation2.types +++ b/tests/baselines/reference/contextualSignatureInstantiation2.types @@ -31,9 +31,9 @@ var id: (x:T) => T; >x : T var r23 = dot(id)(id); ->r23 : (_: T) => {} ->dot(id)(id) : (_: T) => {} ->dot(id) : (g: (_: U) => {}) => (_: U) => {} +>r23 : (_: T) => unknown +>dot(id)(id) : (_: T) => unknown +>dot(id) : (g: (_: U) => unknown) => (_: U) => unknown >dot : (f: (_: T) => S) => (g: (_: U) => T) => (_: U) => S >id : (x: T) => T >id : (x: T) => T diff --git a/tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types b/tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types index 4f1d28c39d4..a25bd5eb3a8 100644 --- a/tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types +++ b/tests/baselines/reference/contextualTypingTwoInstancesOfSameTypeParameter.types @@ -10,13 +10,13 @@ function f6(x: (a: T) => T) { f6(x => f6(y => x = y)); >f6(x => f6(y => x = y)) : any >f6 : (x: (a: T) => T) => any ->x => f6(y => x = y) : (x: {}) => any ->x : {} +>x => f6(y => x = y) : (x: unknown) => any +>x : unknown >f6(y => x = y) : any >f6 : (x: (a: T) => T) => any ->y => x = y : (y: {}) => {} ->y : {} ->x = y : {} ->x : {} ->y : {} +>y => x = y : (y: unknown) => unknown +>y : unknown +>x = y : unknown +>x : unknown +>y : unknown diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.types b/tests/baselines/reference/defaultExportInAwaitExpression01.types index 1f7de76b90e..5c8620ae1dc 100644 --- a/tests/baselines/reference/defaultExportInAwaitExpression01.types +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.types @@ -1,21 +1,21 @@ === tests/cases/conformance/es6/modules/a.ts === const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); ->x : Promise<{}> ->new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> +>x : Promise +>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise >Promise : PromiseConstructor ->( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void ->resolve : (value?: {} | PromiseLike<{}>) => void +>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: unknown) => void, reject: (reason?: any) => void) => void +>resolve : (value?: unknown) => void >reject : (reason?: any) => void >resolve( {} ) : void ->resolve : (value?: {} | PromiseLike<{}>) => void +>resolve : (value?: unknown) => void >{} : {} export default x; ->x : Promise<{}> +>x : Promise === tests/cases/conformance/es6/modules/b.ts === import x from './a'; ->x : Promise<{}> +>x : Promise ( async function() { >( async function() { const value = await x;}() ) : Promise @@ -23,9 +23,9 @@ import x from './a'; >async function() { const value = await x;} : () => Promise const value = await x; ->value : {} ->await x : {} ->x : Promise<{}> +>value : unknown +>await x : unknown +>x : Promise }() ); diff --git a/tests/baselines/reference/defaultExportInAwaitExpression02.types b/tests/baselines/reference/defaultExportInAwaitExpression02.types index 1f7de76b90e..5c8620ae1dc 100644 --- a/tests/baselines/reference/defaultExportInAwaitExpression02.types +++ b/tests/baselines/reference/defaultExportInAwaitExpression02.types @@ -1,21 +1,21 @@ === tests/cases/conformance/es6/modules/a.ts === const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); ->x : Promise<{}> ->new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}> +>x : Promise +>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise >Promise : PromiseConstructor ->( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void ->resolve : (value?: {} | PromiseLike<{}>) => void +>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: unknown) => void, reject: (reason?: any) => void) => void +>resolve : (value?: unknown) => void >reject : (reason?: any) => void >resolve( {} ) : void ->resolve : (value?: {} | PromiseLike<{}>) => void +>resolve : (value?: unknown) => void >{} : {} export default x; ->x : Promise<{}> +>x : Promise === tests/cases/conformance/es6/modules/b.ts === import x from './a'; ->x : Promise<{}> +>x : Promise ( async function() { >( async function() { const value = await x;}() ) : Promise @@ -23,9 +23,9 @@ import x from './a'; >async function() { const value = await x;} : () => Promise const value = await x; ->value : {} ->await x : {} ->x : Promise<{}> +>value : unknown +>await x : unknown +>x : Promise }() ); diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index 31b834ba863..d052166905e 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type '9.9' is not assignable to type 'string'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type '9.9' is not assignable to type 'Date'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type '9.9' is not assignable to type 'void'. -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2741: Property 'id' is missing in type 'D<{}>' but required in type 'I'. -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(41,5): error TS2741: Property 'id' is missing in type 'D<{}>' but required in type 'C'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2741: Property 'id' is missing in type 'D' but required in type 'I'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(41,5): error TS2741: Property 'id' is missing in type 'D' but required in type 'C'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2739: Type 'C' is missing the following properties from type 'D': source, recurse, wrapped tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,28): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(44,5): error TS2322: Type 'C' is not assignable to type '{ id: string; }'. @@ -75,11 +75,11 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd var anInterface: I = new D(); ~~~~~~~~~~~ -!!! error TS2741: Property 'id' is missing in type 'D<{}>' but required in type 'I'. +!!! error TS2741: Property 'id' is missing in type 'D' but required in type 'I'. !!! related TS2728 tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts:2:5: 'id' is declared here. var aClass: C = new D(); ~~~~~~ -!!! error TS2741: Property 'id' is missing in type 'D<{}>' but required in type 'C'. +!!! error TS2741: Property 'id' is missing in type 'D' but required in type 'C'. !!! related TS2728 tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts:6:5: 'id' is declared here. var aGenericClass: D = new C(); ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.types b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.types index 7141a6738d4..f1fab1ab390 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.types +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.types @@ -92,12 +92,12 @@ var aVoid: void = 9.9; var anInterface: I = new D(); >anInterface : I ->new D() : D<{}> +>new D() : D >D : typeof D var aClass: C = new D(); >aClass : C ->new D() : D<{}> +>new D() : D >D : typeof D var aGenericClass: D = new C(); diff --git a/tests/baselines/reference/externalModuleExportingGenericClass.types b/tests/baselines/reference/externalModuleExportingGenericClass.types index 6e85b061458..a6820981012 100644 --- a/tests/baselines/reference/externalModuleExportingGenericClass.types +++ b/tests/baselines/reference/externalModuleExportingGenericClass.types @@ -7,11 +7,11 @@ var v: a; // this should report error var v2: any = (new a()).foo; >v2 : any ->(new a()).foo : {} ->(new a()) : a<{}> ->new a() : a<{}> +>(new a()).foo : unknown +>(new a()) : a +>new a() : a >a : typeof a ->foo : {} +>foo : unknown var v3: number = (new a()).foo; >v3 : number diff --git a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt index def0ff8811e..33d06763bbe 100644 --- a/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt +++ b/tests/baselines/reference/functionTypeArgumentAssignmentCompat.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts(9,1): error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. - Type '{}[]' is not assignable to type 'T'. + Type 'unknown[]' is not assignable to type 'T'. ==== tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts (1 errors) ==== @@ -14,7 +14,7 @@ tests/cases/compiler/functionTypeArgumentAssignmentCompat.ts(9,1): error TS2322: f = g; ~ !!! error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. -!!! error TS2322: Type '{}[]' is not assignable to type 'T'. +!!! error TS2322: Type 'unknown[]' is not assignable to type 'T'. var s = f("str").toUpperCase(); console.log(s); diff --git a/tests/baselines/reference/genericCallTypeArgumentInference.types b/tests/baselines/reference/genericCallTypeArgumentInference.types index 36707a7da4d..0cd6e214273 100644 --- a/tests/baselines/reference/genericCallTypeArgumentInference.types +++ b/tests/baselines/reference/genericCallTypeArgumentInference.types @@ -43,8 +43,8 @@ var r2 = foo2('', 1); // number >1 : 1 var r3 = foo2b(1); // {} ->r3 : {} ->foo2b(1) : {} +>r3 : unknown +>foo2b(1) : unknown >foo2b : (u: U) => T >1 : 1 @@ -186,23 +186,23 @@ var r8 = c.foo5(true, 1); // boolean >1 : 1 var r9 = c.foo6(); // {} ->r9 : {} ->c.foo6() : {} +>r9 : unknown +>c.foo6() : unknown >c.foo6 : () => T >c : C >foo6 : () => T var r10 = c.foo7(''); // {} ->r10 : {} ->c.foo7('') : {} +>r10 : unknown +>c.foo7('') : unknown >c.foo7 : (u: U) => T >c : C >foo7 : (u: U) => T >'' : "" var r11 = c.foo8(); // {} ->r11 : {} ->c.foo8() : {} +>r11 : unknown +>c.foo8() : unknown >c.foo8 : () => T >c : C >foo8 : () => T @@ -297,23 +297,23 @@ var r8 = i.foo5(true, 1); // boolean >1 : 1 var r9 = i.foo6(); // {} ->r9 : {} ->i.foo6() : {} +>r9 : unknown +>i.foo6() : unknown >i.foo6 : () => T >i : I >foo6 : () => T var r10 = i.foo7(''); // {} ->r10 : {} ->i.foo7('') : {} +>r10 : unknown +>i.foo7('') : unknown >i.foo7 : (u: U) => T >i : I >foo7 : (u: U) => T >'' : "" var r11 = i.foo8(); // {} ->r11 : {} ->i.foo8() : {} +>r11 : unknown +>i.foo8() : unknown >i.foo8 : () => T >i : I >foo8 : () => T diff --git a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt index 4aa29b1e050..fe2d76b23de 100644 --- a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt +++ b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: {}) => string; }'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: unknown) => string; }'. Types of property 'cb' are incompatible. - Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: {}) => string'. + Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: unknown) => string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(13,14): error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. Types of property 'cb' are incompatible. Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'. @@ -19,9 +19,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon var arg2: { cb: new (x: T, y: T) => string }; var r2 = foo(arg2); // error ~~~~ -!!! error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: {}) => string; }'. +!!! error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: unknown) => string; }'. !!! error TS2345: Types of property 'cb' are incompatible. -!!! error TS2345: Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: {}) => string'. +!!! error TS2345: Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: unknown) => string'. var arg3: { cb: new (x: string, y: number) => string }; var r3 = foo(arg3); // error ~~~~ diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments.types index 32a10d3cad4..0297af07b23 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.types +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.types @@ -14,8 +14,8 @@ function foo(x: (a: T) => T) { } var r = foo((x: U) => ''); // {} ->r : {} ->foo((x: U) => '') : {} +>r : unknown +>foo((x: U) => '') : unknown >foo : (x: (a: T) => T) => T >(x: U) => '' : (x: U) => string >x : U @@ -30,11 +30,11 @@ var r2 = foo((x: U) => ''); // string >'' : "" var r3 = foo(x => ''); // {} ->r3 : {} ->foo(x => '') : {} +>r3 : unknown +>foo(x => '') : unknown >foo : (x: (a: T) => T) => T ->x => '' : (x: {}) => string ->x : {} +>x => '' : (x: unknown) => string +>x : unknown >'' : "" function foo2(x: T, cb: (a: T) => U) { diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types index 43391dd7cc6..1cd9e7ccd11 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments2.types @@ -35,8 +35,8 @@ var a: { } var r = foo(i); // any ->r : {} ->foo(i) : {} +>r : unknown +>foo(i) : unknown >foo : (x: new (a: T) => T) => T >i : I @@ -53,8 +53,8 @@ var r3 = foo(i2); // string >i2 : I2 var r3b = foo(a); // any ->r3b : {} ->foo(a) : {} +>r3b : unknown +>foo(a) : unknown >foo : (x: new (a: T) => T) => T >a : new (x: T) => T @@ -78,15 +78,15 @@ var r4 = foo2(1, i2); // error >i2 : I2 var r4b = foo2(1, a); // any ->r4b : {} ->foo2(1, a) : {} +>r4b : unknown +>foo2(1, a) : unknown >foo2 : (x: T, cb: new (a: T) => U) => U >1 : 1 >a : new (x: T) => T var r5 = foo2(1, i); // any ->r5 : {} ->foo2(1, i) : {} +>r5 : unknown +>foo2(1, i) : unknown >foo2 : (x: T, cb: new (a: T) => U) => U >1 : 1 >i : I @@ -112,16 +112,16 @@ function foo3(x: T, cb: new(a: T) => U, y: U) { } var r7 = foo3(null, i, ''); // any ->r7 : {} ->foo3(null, i, '') : {} +>r7 : unknown +>foo3(null, i, '') : unknown >foo3 : (x: T, cb: new (a: T) => U, y: U) => U >null : null >i : I >'' : "" var r7b = foo3(null, a, ''); // any ->r7b : {} ->foo3(null, a, '') : {} +>r7b : unknown +>foo3(null, a, '') : unknown >foo3 : (x: T, cb: new (a: T) => U, y: U) => U >null : null >a : new (x: T) => T diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt b/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt index ee15ac0597c..9af10d79a7d 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(10,16): error TS2322: Type '(x: T, y: T) => string' is not assignable to type '(t: {}) => string'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(10,16): error TS2322: Type '(x: T, y: T) => string' is not assignable to type '(t: unknown) => string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts(11,16): error TS2322: Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'. @@ -14,8 +14,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFun // more args not allowed var r2 = foo({ cb: (x: T, y: T) => '' }); // error ~~ -!!! error TS2322: Type '(x: T, y: T) => string' is not assignable to type '(t: {}) => string'. -!!! related TS6500 tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts:3:27: The expected type comes from property 'cb' which is declared here on type '{ cb: (t: {}) => string; }' +!!! error TS2322: Type '(x: T, y: T) => string' is not assignable to type '(t: unknown) => string'. +!!! related TS6500 tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts:3:27: The expected type comes from property 'cb' which is declared here on type '{ cb: (t: unknown) => string; }' var r3 = foo({ cb: (x: string, y: number) => '' }); // error ~~ !!! error TS2322: Type '(x: string, y: number) => string' is not assignable to type '(t: string) => string'. diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments.types b/tests/baselines/reference/genericCallWithGenericSignatureArguments.types index 21649aef549..af5e123d823 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments.types +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments.types @@ -19,14 +19,14 @@ function foo(a: (x: T) => T, b: (x: T) => T) { //var r1 = foo((x: number) => 1, (x: string) => ''); // error var r1b = foo((x) => 1, (x) => ''); // {} => {} ->r1b : (x: {}) => {} ->foo((x) => 1, (x) => '') : (x: {}) => {} +>r1b : (x: unknown) => unknown +>foo((x) => 1, (x) => '') : (x: unknown) => unknown >foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(x) => 1 : (x: {}) => number ->x : {} +>(x) => 1 : (x: unknown) => number +>x : unknown >1 : 1 ->(x) => '' : (x: {}) => string ->x : {} +>(x) => '' : (x: unknown) => string +>x : unknown >'' : "" var r2 = foo((x: Object) => null, (x: string) => ''); // Object => Object @@ -114,15 +114,15 @@ function other(x: T) { >b : T var r6b = foo((a) => a, (b) => b); // {} => {} ->r6b : (x: {}) => {} ->foo((a) => a, (b) => b) : (x: {}) => {} +>r6b : (x: unknown) => unknown +>foo((a) => a, (b) => b) : (x: unknown) => unknown >foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(a) => a : (a: {}) => {} ->a : {} ->a : {} ->(b) => b : (b: {}) => {} ->b : {} ->b : {} +>(a) => a : (a: unknown) => unknown +>a : unknown +>a : unknown +>(b) => b : (b: unknown) => unknown +>b : unknown +>b : unknown } function other2(x: T) { @@ -141,15 +141,15 @@ function other2(x: T) { >b : T var r7b = foo((a) => a, (b) => b); // {} => {} ->r7b : (x: {}) => {} ->foo((a) => a, (b) => b) : (x: {}) => {} +>r7b : (x: unknown) => unknown +>foo((a) => a, (b) => b) : (x: unknown) => unknown >foo : (a: (x: T) => T, b: (x: T) => T) => (x: T) => T ->(a) => a : (a: {}) => {} ->a : {} ->a : {} ->(b) => b : (b: {}) => {} ->b : {} ->b : {} +>(a) => a : (a: unknown) => unknown +>a : unknown +>a : unknown +>(b) => b : (b: unknown) => unknown +>b : unknown +>b : unknown var r8 = r7(null); >r8 : T diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types index e1b41363477..435b69bd753 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments.types @@ -77,8 +77,8 @@ module GenericParameter { >x : number var r7 = foo5(b); // new any => string; new(x:number) => any ->r7 : { new (x: {}): string; new (x: number): {}; } ->foo5(b) : { new (x: {}): string; new (x: number): {}; } +>r7 : { new (x: unknown): string; new (x: number): unknown; } +>foo5(b) : { new (x: unknown): string; new (x: number): unknown; } >foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } >b : { new (x: T): string; new (x: number): T; } @@ -100,8 +100,8 @@ module GenericParameter { >a : { new (x: boolean): string; new (x: number): boolean; } var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string ->r9 : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo6(b) : { new (x: {}): string; new (x: {}, y?: {}): string; } +>r9 : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } +>foo6(b) : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } >foo6 : (cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } >b : { new (x: T): string; new (x: number): T; } @@ -118,8 +118,8 @@ module GenericParameter { } var r13 = foo7(1, b); // new any => string; new(x:any, y?:any) => string ->r13 : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo7(1, b) : { new (x: {}): string; new (x: {}, y?: {}): string; } +>r13 : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } +>foo7(1, b) : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } >1 : 1 >b : { new (x: T): string; new (x: number): T; } @@ -135,15 +135,15 @@ module GenericParameter { >x : number var r14 = foo7(1, c); // new any => string; new(x:any, y?:any) => string ->r14 : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo7(1, c) : { new (x: {}): string; new (x: {}, y?: {}): string; } +>r14 : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } +>foo7(1, c) : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } >1 : 1 >c : { (x: number): T; new (x: T): string; } var r15 = foo7(1, c2); // new any => string; new(x:any, y?:any) => string ->r15 : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo7(1, c2) : { new (x: {}): string; new (x: {}, y?: {}): string; } +>r15 : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } +>foo7(1, c2) : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } >1 : 1 >c2 : { new (x: T): string; new (x: number): T; } diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt index cb40b4acb7a..2e52a9d482c 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts(31,20): error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: {}): string; new (x: {}, y?: {}): string; }'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts(31,20): error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: unknown): string; new (x: unknown, y?: unknown): string; }'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts (1 errors) ==== @@ -34,7 +34,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve var b: { new (x: T, y: T): string }; var r10 = foo6(b); // error ~ -!!! error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: {}): string; new (x: {}, y?: {}): string; }'. +!!! error TS2345: Argument of type 'new (x: T, y: T) => string' is not assignable to parameter of type '{ new (x: unknown): string; new (x: unknown, y?: unknown): string; }'. function foo7(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) { return cb; diff --git a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.types b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.types index 7c2075c4fa6..94183b18354 100644 --- a/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.types +++ b/tests/baselines/reference/genericCallWithOverloadedConstructorTypedArguments2.types @@ -53,8 +53,8 @@ module GenericParameter { >x : T var r6 = foo5(a); // ok ->r6 : { new (x: {}): string; new (x: number): {}; } ->foo5(a) : { new (x: {}): string; new (x: number): {}; } +>r6 : { new (x: unknown): string; new (x: number): unknown; } +>foo5(a) : { new (x: unknown): string; new (x: number): unknown; } >foo5 : (cb: { new (x: T): string; new (x: number): T; }) => { new (x: T): string; new (x: number): T; } >a : new (x: T) => T @@ -93,8 +93,8 @@ module GenericParameter { } var r13 = foo7(1, a); // ok ->r13 : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo7(1, a) : { new (x: {}): string; new (x: {}, y?: {}): string; } +>r13 : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } +>foo7(1, a) : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } >1 : 1 >a : new (x: T) => T @@ -105,8 +105,8 @@ module GenericParameter { >x : number var r14 = foo7(1, c); // ok ->r14 : { new (x: {}): string; new (x: {}, y?: {}): string; } ->foo7(1, c) : { new (x: {}): string; new (x: {}, y?: {}): string; } +>r14 : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } +>foo7(1, c) : { new (x: unknown): string; new (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { new (x: T): string; new (x: T, y?: T): string; }) => { new (x: T): string; new (x: T, y?: T): string; } >1 : 1 >c : { new (x: T): number; new (x: number): T; } diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types index 78917f68af4..b37c03962ac 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments.types @@ -74,8 +74,8 @@ module GenericParameter { >x : number var r7 = foo5(a); // any => string (+1 overload) ->r7 : { (x: {}): string; (x: number): {}; } ->foo5(a) : { (x: {}): string; (x: number): {}; } +>r7 : { (x: unknown): string; (x: number): unknown; } +>foo5(a) : { (x: unknown): string; (x: number): unknown; } >foo5 : (cb: { (x: T): string; (x: number): T; }) => { (x: T): string; (x: number): T; } >a : { (x: T): string; (x: number): T; } @@ -99,16 +99,16 @@ module GenericParameter { >x : any var r9 = foo6((x: T) => ''); // any => string (+1 overload) ->r9 : { (x: {}): string; (x: {}, y?: {}): string; } ->foo6((x: T) => '') : { (x: {}): string; (x: {}, y?: {}): string; } +>r9 : { (x: unknown): string; (x: unknown, y?: unknown): string; } +>foo6((x: T) => '') : { (x: unknown): string; (x: unknown, y?: unknown): string; } >foo6 : (cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } >(x: T) => '' : (x: T) => string >x : T >'' : "" var r11 = foo6((x: T, y?: T) => ''); // any => string (+1 overload) ->r11 : { (x: {}): string; (x: {}, y?: {}): string; } ->foo6((x: T, y?: T) => '') : { (x: {}): string; (x: {}, y?: {}): string; } +>r11 : { (x: unknown): string; (x: unknown, y?: unknown): string; } +>foo6((x: T, y?: T) => '') : { (x: unknown): string; (x: unknown, y?: unknown): string; } >foo6 : (cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } >(x: T, y?: T) => '' : (x: T, y?: T) => string >x : T @@ -137,8 +137,8 @@ module GenericParameter { >x : any var r13 = foo7(1, (x: T) => ''); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] ->r13 : { (x: {}): string; (x: {}, y?: {}): string; } ->foo7(1, (x: T) => '') : { (x: {}): string; (x: {}, y?: {}): string; } +>r13 : { (x: unknown): string; (x: unknown, y?: unknown): string; } +>foo7(1, (x: T) => '') : { (x: unknown): string; (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } >1 : 1 >(x: T) => '' : (x: T) => string @@ -151,8 +151,8 @@ module GenericParameter { >x : number var r14 = foo7(1, a); // any => string (+1 overload) [inferences are made for T, but lambda not contextually typed] ->r14 : { (x: {}): string; (x: {}, y?: {}): string; } ->foo7(1, a) : { (x: {}): string; (x: {}, y?: {}): string; } +>r14 : { (x: unknown): string; (x: unknown, y?: unknown): string; } +>foo7(1, a) : { (x: unknown): string; (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } >1 : 1 >a : { (x: T): string; (x: number): T; } diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt index 9ee5e6f0cfe..2e5b19bcf1b 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments2.ts(28,20): error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: {}): string; (x: {}, y?: {}): string; }'. +tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments2.ts(28,20): error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: unknown): string; (x: unknown, y?: unknown): string; }'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedFunctionTypedArguments2.ts (1 errors) ==== @@ -31,7 +31,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOve var r10 = foo6((x: T, y: T) => ''); // error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: {}): string; (x: {}, y?: {}): string; }'. +!!! error TS2345: Argument of type '(x: T, y: T) => string' is not assignable to parameter of type '{ (x: unknown): string; (x: unknown, y?: unknown): string; }'. function foo7(x:T, cb: { (x: T): string; (x: T, y?: T): string }) { return cb; diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.types b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.types index 6c982af9f91..1d18c07210e 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.types +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.types @@ -48,8 +48,8 @@ module GenericParameter { } var r6 = foo5((x: T) => x); // ok ->r6 : { (x: {}): string; (x: number): {}; } ->foo5((x: T) => x) : { (x: {}): string; (x: number): {}; } +>r6 : { (x: unknown): string; (x: number): unknown; } +>foo5((x: T) => x) : { (x: unknown): string; (x: number): unknown; } >foo5 : (cb: { (x: T): string; (x: number): T; }) => { (x: T): string; (x: number): T; } >(x: T) => x : (x: T) => T >x : T @@ -88,8 +88,8 @@ module GenericParameter { } var r13 = foo7(1, (x: T) => x); // ok ->r13 : { (x: {}): string; (x: {}, y?: {}): string; } ->foo7(1, (x: T) => x) : { (x: {}): string; (x: {}, y?: {}): string; } +>r13 : { (x: unknown): string; (x: unknown, y?: unknown): string; } +>foo7(1, (x: T) => x) : { (x: unknown): string; (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } >1 : 1 >(x: T) => x : (x: T) => T @@ -102,8 +102,8 @@ module GenericParameter { >x : number var r14 = foo7(1, a); // ok ->r14 : { (x: {}): string; (x: {}, y?: {}): string; } ->foo7(1, a) : { (x: {}): string; (x: {}, y?: {}): string; } +>r14 : { (x: unknown): string; (x: unknown, y?: unknown): string; } +>foo7(1, a) : { (x: unknown): string; (x: unknown, y?: unknown): string; } >foo7 : (x: T, cb: { (x: T): string; (x: T, y?: T): string; }) => { (x: T): string; (x: T, y?: T): string; } >1 : 1 >a : { (x: T): number; (x: number): T; } diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types index 3e4c0c1e3a5..01f98d4bbfc 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.types @@ -26,8 +26,8 @@ module ImmediatelyFix { >C : typeof C var r = c.foo((x: U) => ''); // {} ->r : {} ->c.foo((x: U) => '') : {} +>r : unknown +>c.foo((x: U) => '') : unknown >c.foo : (x: (a: T) => T) => T >c : C >foo : (x: (a: T) => T) => T @@ -46,13 +46,13 @@ module ImmediatelyFix { >'' : "" var r3 = c.foo(x => ''); // {} ->r3 : {} ->c.foo(x => '') : {} +>r3 : unknown +>c.foo(x => '') : unknown >c.foo : (x: (a: T) => T) => T >c : C >foo : (x: (a: T) => T) => T ->x => '' : (x: {}) => string ->x : {} +>x => '' : (x: unknown) => string +>x : unknown >'' : "" class C2 { diff --git a/tests/baselines/reference/genericConstructExpressionWithoutArgs.types b/tests/baselines/reference/genericConstructExpressionWithoutArgs.types index 5771e1536cd..a3ee837c292 100644 --- a/tests/baselines/reference/genericConstructExpressionWithoutArgs.types +++ b/tests/baselines/reference/genericConstructExpressionWithoutArgs.types @@ -15,8 +15,8 @@ class C { } var c = new C // C ->c : C<{}> ->new C : C<{}> +>c : C +>new C : C >C : typeof C var c2 = new C // error, type params are actually part of the arg list so you need both diff --git a/tests/baselines/reference/genericDefaults.js b/tests/baselines/reference/genericDefaults.js index 4cd1127724f..842abbde52f 100644 --- a/tests/baselines/reference/genericDefaults.js +++ b/tests/baselines/reference/genericDefaults.js @@ -980,7 +980,7 @@ declare const Base01c02: Base01; declare const Base01c03: Base01; declare class Derived01 extends Base01 { } -declare const Derived01c00: Derived01<{}>; +declare const Derived01c00: Derived01; declare const Derived01c01: Derived01; declare const Derived01c02: Derived01; declare const Derived01c03: Derived01; diff --git a/tests/baselines/reference/genericDefaults.types b/tests/baselines/reference/genericDefaults.types index c439d96a08b..5bea18de7c3 100644 --- a/tests/baselines/reference/genericDefaults.types +++ b/tests/baselines/reference/genericDefaults.types @@ -62,7 +62,7 @@ declare function f01(a?: T): T; // inference f01(); ->f01() : {} +>f01() : unknown >f01 : (a?: T) => T f01(a); @@ -126,7 +126,7 @@ declare function f03(a?: T): T; // inference f03(); ->f03() : {} +>f03() : unknown >f03 : (a?: T) => T f03(a); @@ -166,7 +166,7 @@ declare function f04(a?: T, b?: U): [T, U]; // inference f04(); ->f04() : [{}, B] +>f04() : [unknown, B] >f04 : (a?: T, b?: U) => [T, U] f04(a); @@ -241,7 +241,7 @@ declare function f05(a?: T, b?: U): [T, U]; // inference f05(); ->f05() : [{}, {}] +>f05() : [unknown, unknown] >f05 : (a?: T, b?: U) => [T, U] f05(a); @@ -404,7 +404,7 @@ declare function f07(a?: T, b?: U, c?: V): [T, U, V]; // inference f07(); ->f07() : [{}, B, B] +>f07() : [unknown, B, B] >f07 : (a?: T, b?: U, c?: V) => [T, U, V] f07(a, b); @@ -627,7 +627,7 @@ declare function f09(a?: T, b?: U): [T, U]; // inference f09(); ->f09() : [{}, {}] +>f09() : [unknown, unknown] >f09 : (a?: T, b?: U) => [T, U] f09(a); @@ -780,7 +780,7 @@ declare function f11(a?: T, b?: U): [T, U]; // inference f11(); ->f11() : [{}, {} | B] +>f11() : [unknown, unknown] >f11 : (a?: T, b?: U) => [T, U] f11(a); @@ -852,7 +852,7 @@ declare function f12(a?: T, b?: U): [T, U]; // inference f12(); ->f12() : [{}, B] +>f12() : [unknown, B] >f12 : (a?: T, b?: U) => [T, U] f12(a); @@ -918,7 +918,7 @@ declare function f13(a?: T, b?: U): [T, U]; // inference f13(); ->f13() : [{}, B] +>f13() : [unknown, B] >f13 : (a?: T, b?: U) => [T, U] f13(a); @@ -985,11 +985,11 @@ declare function f14(a?: T, b?: U, c?: V): [T, U, V]; // inference f14(); ->f14() : [{}, {}, C] +>f14() : [unknown, unknown, C] >f14 : (a?: T, b?: U, c?: V) => [T, U, V] f14(a); ->f14(a) : [A, {}, C] +>f14(a) : [A, unknown, C] >f14 : (a?: T, b?: U, c?: V) => [T, U, V] >a : A @@ -1089,7 +1089,7 @@ declare function f15(a?: T, b?: U): [T, U]; // inference f15(); ->f15() : [{}, {}] +>f15() : [unknown, unknown] >f15 : (a?: T, b?: U) => [T, U] f15(a); @@ -1144,11 +1144,11 @@ declare function f16(a?: T, b?: U, c?: V): [T, U, V]; // no inference f16(); ->f16() : [{}, {}, {}] +>f16() : [unknown, unknown, unknown] >f16 : (a?: T, b?: U, c?: V) => [T, U, V] f16(a); ->f16(a) : [A, {}, {}] +>f16(a) : [A, unknown, unknown] >f16 : (a?: T, b?: U, c?: V) => [T, U, V] >a : A @@ -1241,7 +1241,7 @@ declare function f17(a?: T, b?: U): [T, U]; // inference f17(); ->f17() : [{}, {} | B] +>f17() : [unknown, unknown] >f17 : (a?: T, b?: U) => [T, U] f17(a); @@ -1314,11 +1314,11 @@ declare function f18(a?: T, b?: U, c?: V): [T, U, V]; // inference f18(); ->f18() : [{}, {}, {} | C] +>f18() : [unknown, unknown, unknown] >f18 : (a?: T, b?: U, c?: V) => [T, U, V] f18(a); ->f18(a) : [A, {}, {} | C] +>f18(a) : [A, unknown, unknown] >f18 : (a?: T, b?: U, c?: V) => [T, U, V] >a : A @@ -1432,7 +1432,7 @@ declare function f19(a?: T, b?: U): [T, U]; // inference f19(); ->f19() : [{}, B] +>f19() : [unknown, B] >f19 : (a?: T, b?: U) => [T, U] f19(a); @@ -1505,11 +1505,11 @@ declare function f20(a?: T, b?: U, c?: V): [T, U, V]; // inference f20(); ->f20() : [{}, {}, C] +>f20() : [unknown, unknown, C] >f20 : (a?: T, b?: U, c?: V) => [T, U, V] f20(a); ->f20(a) : [A, {}, C] +>f20(a) : [A, unknown, C] >f20 : (a?: T, b?: U, c?: V) => [T, U, V] >a : A @@ -1843,8 +1843,8 @@ declare class Derived01 extends Base01 { } >Base01 : Base01 const Derived01c00 = new Derived01(); ->Derived01c00 : Derived01<{}> ->new Derived01() : Derived01<{}> +>Derived01c00 : Derived01 +>new Derived01() : Derived01 >Derived01 : typeof Derived01 const Derived01c01 = new Derived01(1); diff --git a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt index c8430818983..4f24a456023 100644 --- a/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt +++ b/tests/baselines/reference/genericFunctionCallSignatureReturnTypeMismatch.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts(6,1): error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. - Type '{}[]' is not assignable to type 'T'. + Type 'unknown[]' is not assignable to type 'T'. ==== tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts (1 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/genericFunctionCallSignatureReturnTypeMismatch.ts(6,1): err f = g; ~ !!! error TS2322: Type '() => S[]' is not assignable to type '(x: T) => T'. -!!! error TS2322: Type '{}[]' is not assignable to type 'T'. +!!! error TS2322: Type 'unknown[]' is not assignable to type 'T'. var s = f("str").toUpperCase(); diff --git a/tests/baselines/reference/genericFunctionInference1.types b/tests/baselines/reference/genericFunctionInference1.types index 7b0cb2a0e36..5df3fa398c5 100644 --- a/tests/baselines/reference/genericFunctionInference1.types +++ b/tests/baselines/reference/genericFunctionInference1.types @@ -416,8 +416,8 @@ declare function pipe5(f: (a: A) => B): { f: (a: A) => B }; >a : A const f50 = pipe5(list); // No higher order inference ->f50 : { f: (a: {}) => {}[]; } ->pipe5(list) : { f: (a: {}) => {}[]; } +>f50 : { f: (a: unknown) => unknown[]; } +>pipe5(list) : { f: (a: unknown) => unknown[]; } >pipe5 : (f: (a: A) => B) => { f: (a: A) => B; } >list : (a: T) => T[] @@ -835,7 +835,7 @@ foo2(() => {}); >() => {} : () => void foo2(identity); ->foo2(identity) : [(value: T) => T, {}] +>foo2(identity) : [(value: T) => T, unknown] >foo2 : (fn: T, a?: U | undefined, b?: U | undefined) => [T, U] >identity : (value: T) => T diff --git a/tests/baselines/reference/genericFunctionParameters.js b/tests/baselines/reference/genericFunctionParameters.js index 55f4196e77b..92663cabdb2 100644 --- a/tests/baselines/reference/genericFunctionParameters.js +++ b/tests/baselines/reference/genericFunctionParameters.js @@ -25,10 +25,10 @@ var x = s(function (a) { return a.init(); }); // x is any, should have been {} declare function f1(cb: (x: S) => T): T; declare function f2(cb: (x: S) => T): T; declare function f3(cb: >(x: S) => T): T; -declare let x1: {}; +declare let x1: unknown; declare let x2: number; declare let x3: any[]; declare const s: (go: (ops: { init(): S; }) => R) => R; -declare const x: {}; +declare const x: unknown; diff --git a/tests/baselines/reference/genericFunctionParameters.types b/tests/baselines/reference/genericFunctionParameters.types index b297eb0813b..6f59aea1fbf 100644 --- a/tests/baselines/reference/genericFunctionParameters.types +++ b/tests/baselines/reference/genericFunctionParameters.types @@ -15,8 +15,8 @@ declare function f3(cb: >(x: S) => T): T; >x : S let x1 = f1(x => x); // {} ->x1 : {} ->f1(x => x) : {} +>x1 : unknown +>f1(x => x) : unknown >f1 : (cb: (x: S) => T) => T >x => x : (x: S) => S >x : S @@ -47,8 +47,8 @@ declare const s: (go: (ops: { init(): S; }) => R) => R; >init : () => S const x = s(a => a.init()); // x is any, should have been {} ->x : {} ->s(a => a.init()) : {} +>x : unknown +>s(a => a.init()) : unknown >s : (go: (ops: { init(): S; }) => R) => R >a => a.init() : (a: { init(): S; }) => S >a : { init(): S; } diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types index 4cfcb93dfd0..4a7498563cc 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters1.types @@ -13,20 +13,20 @@ var utils: Utils; >utils : Utils utils.fold(); // no error ->utils.fold() : {} +>utils.fold() : unknown >utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T utils.fold(null); // no error ->utils.fold(null) : {} +>utils.fold(null) : unknown >utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >null : null utils.fold(null, null); // no error ->utils.fold(null, null) : {} +>utils.fold(null, null) : unknown >utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T @@ -34,7 +34,7 @@ utils.fold(null, null); // no error >null : null utils.fold(null, null, null); // no error ->utils.fold(null, null, null) : {} +>utils.fold(null, null, null) : unknown >utils.fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c?: T[], folder?: (s: S, t: T) => T, init?: S) => T diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.types b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.types index 345ec740a86..7c385445c07 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters2.types +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters2.types @@ -19,14 +19,14 @@ utils.fold(); // error >fold : (c: T[], folder?: (s: S, t: T) => T, init?: S) => T utils.fold(null); // no error ->utils.fold(null) : {} +>utils.fold(null) : unknown >utils.fold : (c: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c: T[], folder?: (s: S, t: T) => T, init?: S) => T >null : null utils.fold(null, null); // no error ->utils.fold(null, null) : {} +>utils.fold(null, null) : unknown >utils.fold : (c: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c: T[], folder?: (s: S, t: T) => T, init?: S) => T @@ -34,7 +34,7 @@ utils.fold(null, null); // no error >null : null utils.fold(null, null, null); // error: Unable to invoke type with no call signatures ->utils.fold(null, null, null) : {} +>utils.fold(null, null, null) : unknown >utils.fold : (c: T[], folder?: (s: S, t: T) => T, init?: S) => T >utils : Utils >fold : (c: T[], folder?: (s: S, t: T) => T, init?: S) => T diff --git a/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.types b/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.types index 0f3db6e9572..dad4ebdc4dd 100644 --- a/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.types +++ b/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.types @@ -15,12 +15,12 @@ var x2 = new SS < number>; // Correctly give error >SS : typeof SS var x3 = new SS(); // OK ->x3 : SS<{}> ->new SS() : SS<{}> +>x3 : SS +>new SS() : SS >SS : typeof SS var x4 = new SS; // Should be allowed, but currently give error ('supplied parameters do not match any signature of the call target') ->x4 : SS<{}> ->new SS : SS<{}> +>x4 : SS +>new SS : SS >SS : typeof SS diff --git a/tests/baselines/reference/genericRestParameters3.errors.txt b/tests/baselines/reference/genericRestParameters3.errors.txt index cd9f677c549..612140ea940 100644 --- a/tests/baselines/reference/genericRestParameters3.errors.txt +++ b/tests/baselines/reference/genericRestParameters3.errors.txt @@ -22,12 +22,12 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(31,21): error TS234 Property '0' is missing in type 'CoolArray' but required in type '[(...args: any[]) => void]'. tests/cases/conformance/types/rest/genericRestParameters3.ts(38,32): error TS2345: Argument of type '[10, 20]' is not assignable to parameter of type 'CoolArray'. Property 'hello' is missing in type '[10, 20]' but required in type 'CoolArray'. -tests/cases/conformance/types/rest/genericRestParameters3.ts(43,1): error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray<{}>'. - Property 'hello' is missing in type '[]' but required in type 'CoolArray<{}>'. -tests/cases/conformance/types/rest/genericRestParameters3.ts(44,5): error TS2345: Argument of type '[number]' is not assignable to parameter of type 'CoolArray<{}>'. - Property 'hello' is missing in type '[number]' but required in type 'CoolArray<{}>'. -tests/cases/conformance/types/rest/genericRestParameters3.ts(45,5): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type 'CoolArray<{}>'. - Property 'hello' is missing in type '[number, number]' but required in type 'CoolArray<{}>'. +tests/cases/conformance/types/rest/genericRestParameters3.ts(43,1): error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray'. + Property 'hello' is missing in type '[]' but required in type 'CoolArray'. +tests/cases/conformance/types/rest/genericRestParameters3.ts(44,5): error TS2345: Argument of type '[number]' is not assignable to parameter of type 'CoolArray'. + Property 'hello' is missing in type '[number]' but required in type 'CoolArray'. +tests/cases/conformance/types/rest/genericRestParameters3.ts(45,5): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type 'CoolArray'. + Property 'hello' is missing in type '[number, number]' but required in type 'CoolArray'. tests/cases/conformance/types/rest/genericRestParameters3.ts(46,5): error TS2345: Argument of type 'number[]' is not assignable to parameter of type 'CoolArray'. Property 'hello' is missing in type 'number[]' but required in type 'CoolArray'. tests/cases/conformance/types/rest/genericRestParameters3.ts(53,5): error TS2345: Argument of type '["what"]' is not assignable to parameter of type '[] | [number, string]'. @@ -115,18 +115,18 @@ tests/cases/conformance/types/rest/genericRestParameters3.ts(53,5): error TS2345 baz(); // Error ~~~~~ -!!! error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray<{}>'. -!!! error TS2345: Property 'hello' is missing in type '[]' but required in type 'CoolArray<{}>'. +!!! error TS2345: Argument of type '[]' is not assignable to parameter of type 'CoolArray'. +!!! error TS2345: Property 'hello' is missing in type '[]' but required in type 'CoolArray'. !!! related TS2728 tests/cases/conformance/types/rest/genericRestParameters3.ts:24:5: 'hello' is declared here. baz(1); // Error ~ -!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type 'CoolArray<{}>'. -!!! error TS2345: Property 'hello' is missing in type '[number]' but required in type 'CoolArray<{}>'. +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type 'CoolArray'. +!!! error TS2345: Property 'hello' is missing in type '[number]' but required in type 'CoolArray'. !!! related TS2728 tests/cases/conformance/types/rest/genericRestParameters3.ts:24:5: 'hello' is declared here. baz(1, 2); // Error ~ -!!! error TS2345: Argument of type '[number, number]' is not assignable to parameter of type 'CoolArray<{}>'. -!!! error TS2345: Property 'hello' is missing in type '[number, number]' but required in type 'CoolArray<{}>'. +!!! error TS2345: Argument of type '[number, number]' is not assignable to parameter of type 'CoolArray'. +!!! error TS2345: Property 'hello' is missing in type '[number, number]' but required in type 'CoolArray'. !!! related TS2728 tests/cases/conformance/types/rest/genericRestParameters3.ts:24:5: 'hello' is declared here. baz(...ca); // Error ~~~~~ diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.types b/tests/baselines/reference/getAndSetNotIdenticalType2.types index db6ff47a809..b5d4705fd6b 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType2.types +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.types @@ -31,20 +31,20 @@ class C { } var x = new C(); ->x : C<{}> ->new C() : C<{}> +>x : C +>new C() : C >C : typeof C var r = x.x; ->r : A<{}> ->x.x : A<{}> ->x : C<{}> ->x : A<{}> +>r : A +>x.x : A +>x : C +>x : A x.x = r; ->x.x = r : A<{}> ->x.x : A<{}> ->x : C<{}> ->x : A<{}> ->r : A<{}> +>x.x = r : A +>x.x : A +>x : C +>x : A +>r : A diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.types b/tests/baselines/reference/getAndSetNotIdenticalType3.types index 2e24acff99c..e5722f57393 100644 --- a/tests/baselines/reference/getAndSetNotIdenticalType3.types +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.types @@ -31,20 +31,20 @@ class C { } var x = new C(); ->x : C<{}> ->new C() : C<{}> +>x : C +>new C() : C >C : typeof C var r = x.x; >r : A >x.x : A ->x : C<{}> +>x : C >x : A x.x = r; >x.x = r : A >x.x : A ->x : C<{}> +>x : C >x : A >r : A diff --git a/tests/baselines/reference/implicitAnyGenerics.types b/tests/baselines/reference/implicitAnyGenerics.types index 426c22a9330..f7f3d0596fb 100644 --- a/tests/baselines/reference/implicitAnyGenerics.types +++ b/tests/baselines/reference/implicitAnyGenerics.types @@ -7,8 +7,8 @@ class C { } var c = new C(); ->c : C<{}> ->new C() : C<{}> +>c : C +>new C() : C >C : typeof C var c2 = new C(); @@ -69,7 +69,7 @@ function foo(): T { return null; }; >null : null foo() ->foo() : {} +>foo() : unknown >foo : () => T foo(); diff --git a/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.errors.txt b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.errors.txt new file mode 100644 index 00000000000..bcc9d9a05b8 --- /dev/null +++ b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts(9,3): error TS2345: Argument of type '{ name: string; age: number; }[]' is not assignable to parameter of type '{ [x: string]: unknown; }'. + Index signature is missing in type '{ name: string; age: number; }[]'. + + +==== tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts (1 errors) ==== + declare function f(x: { [x: string]: T }): T; + + var stooges = [ + { name: "moe", age: 40 }, + { name: "larry", age: 50 }, + { name: "curly", age: 60 } + ]; + + f(stooges); // Should throw + ~~~~~~~ +!!! error TS2345: Argument of type '{ name: string; age: number; }[]' is not assignable to parameter of type '{ [x: string]: unknown; }'. +!!! error TS2345: Index signature is missing in type '{ name: string; age: number; }[]'. + \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.js b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.js new file mode 100644 index 00000000000..395e4a9dc0a --- /dev/null +++ b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.js @@ -0,0 +1,19 @@ +//// [indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts] +declare function f(x: { [x: string]: T }): T; + +var stooges = [ + { name: "moe", age: 40 }, + { name: "larry", age: 50 }, + { name: "curly", age: 60 } +]; + +f(stooges); // Should throw + + +//// [indexSignatureOfTypeUnknownStillRequiresIndexSignature.js] +var stooges = [ + { name: "moe", age: 40 }, + { name: "larry", age: 50 }, + { name: "curly", age: 60 } +]; +f(stooges); // Should throw diff --git a/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.symbols b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.symbols new file mode 100644 index 00000000000..e14e364bb6e --- /dev/null +++ b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts === +declare function f(x: { [x: string]: T }): T; +>f : Symbol(f, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 0, 0)) +>T : Symbol(T, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 0, 19)) +>x : Symbol(x, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 0, 48)) +>x : Symbol(x, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 0, 54)) +>T : Symbol(T, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 0, 19)) +>T : Symbol(T, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 0, 19)) + +var stooges = [ +>stooges : Symbol(stooges, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 2, 3)) + + { name: "moe", age: 40 }, +>name : Symbol(name, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 3, 3)) +>age : Symbol(age, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 3, 16)) + + { name: "larry", age: 50 }, +>name : Symbol(name, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 4, 3)) +>age : Symbol(age, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 4, 18)) + + { name: "curly", age: 60 } +>name : Symbol(name, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 5, 3)) +>age : Symbol(age, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 5, 18)) + +]; + +f(stooges); // Should throw +>f : Symbol(f, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 0, 0)) +>stooges : Symbol(stooges, Decl(indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts, 2, 3)) + diff --git a/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.types b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.types new file mode 100644 index 00000000000..95f3ddcaf54 --- /dev/null +++ b/tests/baselines/reference/indexSignatureOfTypeUnknownStillRequiresIndexSignature.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts === +declare function f(x: { [x: string]: T }): T; +>f : (x: { [x: string]: T; }) => T +>x : { [x: string]: T; } +>x : string + +var stooges = [ +>stooges : { name: string; age: number; }[] +>[ { name: "moe", age: 40 }, { name: "larry", age: 50 }, { name: "curly", age: 60 }] : { name: string; age: number; }[] + + { name: "moe", age: 40 }, +>{ name: "moe", age: 40 } : { name: string; age: number; } +>name : string +>"moe" : "moe" +>age : number +>40 : 40 + + { name: "larry", age: 50 }, +>{ name: "larry", age: 50 } : { name: string; age: number; } +>name : string +>"larry" : "larry" +>age : number +>50 : 50 + + { name: "curly", age: 60 } +>{ name: "curly", age: 60 } : { name: string; age: number; } +>name : string +>"curly" : "curly" +>age : number +>60 : 60 + +]; + +f(stooges); // Should throw +>f(stooges) : any +>f : (x: { [x: string]: T; }) => T +>stooges : { name: string; age: number; }[] + diff --git a/tests/baselines/reference/indexSignatureTypeInference.errors.txt b/tests/baselines/reference/indexSignatureTypeInference.errors.txt index f93bfc6ce40..aa25f11db59 100644 --- a/tests/baselines/reference/indexSignatureTypeInference.errors.txt +++ b/tests/baselines/reference/indexSignatureTypeInference.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts(18,27): error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap<{}>'. +tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts(18,27): error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap'. Index signature is missing in type 'NumberMap'. @@ -22,7 +22,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureType var v1 = numberMapToArray(stringMap); // Ok var v1 = stringMapToArray(numberMap); // Error expected here ~~~~~~~~~ -!!! error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap<{}>'. +!!! error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap'. !!! error TS2345: Index signature is missing in type 'NumberMap'. var v1 = stringMapToArray(stringMap); // Ok \ No newline at end of file diff --git a/tests/baselines/reference/indexerReturningTypeParameter1.types b/tests/baselines/reference/indexerReturningTypeParameter1.types index 635e7e4b778..2e43313b3d6 100644 --- a/tests/baselines/reference/indexerReturningTypeParameter1.types +++ b/tests/baselines/reference/indexerReturningTypeParameter1.types @@ -8,8 +8,8 @@ var a: f; >a : f var r = a.groupBy(); ->r : { [key: string]: {}[]; } ->a.groupBy() : { [key: string]: {}[]; } +>r : { [key: string]: unknown[]; } +>a.groupBy() : { [key: string]: unknown[]; } >a.groupBy : () => { [key: string]: T[]; } >a : f >groupBy : () => { [key: string]: T[]; } @@ -29,8 +29,8 @@ var a2: c; >a2 : c var r2 = a2.groupBy(); ->r2 : { [key: string]: {}[]; } ->a2.groupBy() : { [key: string]: {}[]; } +>r2 : { [key: string]: unknown[]; } +>a2.groupBy() : { [key: string]: unknown[]; } >a2.groupBy : () => { [key: string]: T[]; } >a2 : c >groupBy : () => { [key: string]: T[]; } diff --git a/tests/baselines/reference/inferTypes1.types b/tests/baselines/reference/inferTypes1.types index c3f51879979..149ee287d6b 100644 --- a/tests/baselines/reference/inferTypes1.types +++ b/tests/baselines/reference/inferTypes1.types @@ -62,7 +62,7 @@ type T11 = ReturnType<(s: string) => void>; // void >s : string type T12 = ReturnType<(() => T)>; // {} ->T12 : {} +>T12 : unknown type T13 = ReturnType<(() => T)>; // number[] >T13 : number[] @@ -110,7 +110,7 @@ type ArgumentType any> = T extends (a: infer A) => any ? A >a : A type T20 = ArgumentType<() => void>; // {} ->T20 : {} +>T20 : unknown type T21 = ArgumentType<(x: string) => number>; // string >T21 : string diff --git a/tests/baselines/reference/inferenceLimit.types b/tests/baselines/reference/inferenceLimit.types index be4c6b63a58..6aa7ab501ea 100644 --- a/tests/baselines/reference/inferenceLimit.types +++ b/tests/baselines/reference/inferenceLimit.types @@ -29,15 +29,15 @@ export class BrokenClass { >[] : undefined[] let populateItems = (order) => { ->populateItems : (order: any) => Promise<{}> ->(order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); } : (order: any) => Promise<{}> +>populateItems : (order: any) => Promise +>(order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); } : (order: any) => Promise >order : any return new Promise((resolve, reject) => { ->new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }) : Promise<{}> +>new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }) : Promise >Promise : PromiseConstructor ->(resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void ->resolve : (value?: {} | PromiseLike<{}>) => void +>(resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); } : (resolve: (value?: unknown) => void, reject: (reason?: any) => void) => void +>resolve : (value?: unknown) => void >reject : (reason?: any) => void this.doStuff(order.id) @@ -65,7 +65,7 @@ export class BrokenClass { resolve(order); >resolve(order) : void ->resolve : (value?: {} | PromiseLike<{}>) => void +>resolve : (value?: unknown) => void >order : any }); @@ -74,19 +74,19 @@ export class BrokenClass { return Promise.all(result.map(populateItems)) >Promise.all(result.map(populateItems)) .then((orders: Array) => { resolve(orders); }) : Promise ->Promise.all(result.map(populateItems)) .then : (onfulfilled?: (value: {}[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise ->Promise.all(result.map(populateItems)) : Promise<{}[]> +>Promise.all(result.map(populateItems)) .then : (onfulfilled?: (value: unknown[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>Promise.all(result.map(populateItems)) : Promise >Promise.all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } >Promise : PromiseConstructor >all : { (values: Iterable>): Promise; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; (values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; (values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; (values: (T | PromiseLike)[]): Promise; } ->result.map(populateItems) : Promise<{}>[] +>result.map(populateItems) : Promise[] >result.map : (callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] >result : MyModule.MyModel[] >map : (callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] ->populateItems : (order: any) => Promise<{}> +>populateItems : (order: any) => Promise .then((orders: Array) => { ->then : (onfulfilled?: (value: {}[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>then : (onfulfilled?: (value: unknown[]) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >(orders: Array) => { resolve(orders); } : (orders: MyModule.MyModel[]) => void >orders : MyModule.MyModel[] >MyModule : any diff --git a/tests/baselines/reference/inferentialTypingUsingApparentType3.types b/tests/baselines/reference/inferentialTypingUsingApparentType3.types index 355351cbbad..046bf9a92db 100644 --- a/tests/baselines/reference/inferentialTypingUsingApparentType3.types +++ b/tests/baselines/reference/inferentialTypingUsingApparentType3.types @@ -38,8 +38,8 @@ class ObjectField }> { } var person = new ObjectField({ ->person : ObjectField<{}, { id: NumberField; name: CharField; }> ->new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { id: NumberField; name: CharField; }> +>person : ObjectField +>new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField >ObjectField : typeof ObjectField >{ id: new NumberField(), name: new CharField()} : { id: NumberField; name: CharField; } @@ -58,7 +58,7 @@ var person = new ObjectField({ person.fields.id; >person.fields.id : NumberField >person.fields : { id: NumberField; name: CharField; } ->person : ObjectField<{}, { id: NumberField; name: CharField; }> +>person : ObjectField >fields : { id: NumberField; name: CharField; } >id : NumberField diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types b/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types index 698cc127675..59ea4a78fa2 100644 --- a/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeZip.types @@ -15,8 +15,8 @@ var zipWith: (a: T[], b: S[], f: (x: T) => (y: S) => U) => U[]; >y : S var result = zipWith([1, 2], ['a', 'b'], pair); ->result : { x: number; y: {}; }[] ->zipWith([1, 2], ['a', 'b'], pair) : { x: number; y: {}; }[] +>result : { x: number; y: unknown; }[] +>zipWith([1, 2], ['a', 'b'], pair) : { x: number; y: unknown; }[] >zipWith : (a: T[], b: S[], f: (x: T) => (y: S) => U) => U[] >[1, 2] : number[] >1 : 1 @@ -29,8 +29,8 @@ var result = zipWith([1, 2], ['a', 'b'], pair); var i = result[0].x; // number >i : number >result[0].x : number ->result[0] : { x: number; y: {}; } ->result : { x: number; y: {}; }[] +>result[0] : { x: number; y: unknown; } +>result : { x: number; y: unknown; }[] >0 : 0 >x : number diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types index d1332d42a08..4cb3e4b3126 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.types @@ -12,8 +12,8 @@ var a = new A(); >A : typeof A var b1 = new B(); // no error ->b1 : B<{}> ->new B() : B<{}> +>b1 : B +>new B() : B >B : typeof B var b2: B = new B(); // no error diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types index 5b318a9f86e..ccb614a0f4d 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.types @@ -46,8 +46,8 @@ var n2 = new N.D2(); // error >D2 : typeof N.D2 var n3 = new N.D2(); // no error, D2 ->n3 : N.D2<{}> ->new N.D2() : N.D2<{}> +>n3 : N.D2 +>new N.D2() : N.D2 >N.D2 : typeof N.D2 >N : typeof N >D2 : typeof N.D2 diff --git a/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types b/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types index 8f3c0a5dcab..bc252b55881 100644 --- a/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types +++ b/tests/baselines/reference/instantiateGenericClassWithZeroTypeArguments.types @@ -9,8 +9,8 @@ class C { } var c = new C(); ->c : C<{}> ->new C() : C<{}> +>c : C +>new C() : C >C : typeof C class D { @@ -24,7 +24,7 @@ class D { } var d = new D(); ->d : D<{}, {}> ->new D() : D<{}, {}> +>d : D +>new D() : D >D : typeof D diff --git a/tests/baselines/reference/jsxInExtendsClause.types b/tests/baselines/reference/jsxInExtendsClause.types index 7f8de51b081..2ac03db0693 100644 --- a/tests/baselines/reference/jsxInExtendsClause.types +++ b/tests/baselines/reference/jsxInExtendsClause.types @@ -15,7 +15,7 @@ declare function createComponentClass

(factory: () => React.ComponentClass

) class Foo extends createComponentClass(() => class extends React.Component<{}, {}> { >Foo : Foo ->createComponentClass(() => class extends React.Component<{}, {}> { render() { return Hello, world!; }}) : React.Component<{}, {}> +>createComponentClass(() => class extends React.Component<{}, {}> { render() { return Hello, world!; }}) : React.Component >createComponentClass :

(factory: () => React.ComponentClass

) => React.ComponentClass

>() => class extends React.Component<{}, {}> { render() { return Hello, world!; }} : () => typeof (Anonymous class) >class extends React.Component<{}, {}> { render() { return Hello, world!; }} : typeof (Anonymous class) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 793313fdaa5..7328bfe3fee 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -1255,13 +1255,13 @@ declare type Thing = { declare function f1(thing: Thing): void; declare const assignTo2: (object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2]; declare function one(handler: (t: T) => void): T; -declare var empty: {}; +declare var empty: unknown; declare type Handlers = { [K in keyof T]: (t: T[K]) => void; }; declare function on(handlerHash: Handlers): T; declare var hashOfEmpty1: { - test: {}; + test: unknown; }; declare var hashOfEmpty2: { test: boolean; @@ -1276,7 +1276,7 @@ declare class Component1 { } declare let c1: Component1<{ hello: string; -}, {}>; +}, unknown>; interface Options2 { data?: Data; computed?: Computed; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index 2a7a19ea30c..e30aa81a790 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -1523,8 +1523,8 @@ declare function one(handler: (t: T) => void): T >t : T var empty = one(() => {}) // inferred as {}, expected ->empty : {} ->one(() => {}) : {} +>empty : unknown +>one(() => {}) : unknown >one : (handler: (t: T) => void) => T >() => {} : () => void @@ -1537,8 +1537,8 @@ declare function on(handlerHash: Handlers): T >handlerHash : Handlers var hashOfEmpty1 = on({ test: () => {} }); // {} ->hashOfEmpty1 : { test: {}; } ->on({ test: () => {} }) : { test: {}; } +>hashOfEmpty1 : { test: unknown; } +>on({ test: () => {} }) : { test: unknown; } >on : (handlerHash: Handlers) => T >{ test: () => {} } : { test: () => void; } >test : () => void @@ -1575,8 +1575,8 @@ declare class Component1 { } let c1 = new Component1({ ->c1 : Component1<{ hello: string; }, {}> ->new Component1({ data: { hello: "" }}) : Component1<{ hello: string; }, {}> +>c1 : Component1<{ hello: string; }, unknown> +>new Component1({ data: { hello: "" }}) : Component1<{ hello: string; }, unknown> >Component1 : typeof Component1 >{ data: { hello: "" }} : { data: { hello: string; }; } @@ -1593,7 +1593,7 @@ let c1 = new Component1({ c1.get("hello"); >c1.get("hello") : string >c1.get : (key: K) => { hello: string; }[K] ->c1 : Component1<{ hello: string; }, {}> +>c1 : Component1<{ hello: string; }, unknown> >get : (key: K) => { hello: string; }[K] >"hello" : "hello" diff --git a/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt b/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt index 41edb0f6924..f83f01f77bf 100644 --- a/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeInferenceErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts(16,9): error TS2322: Type 'number' is not assignable to type '() => {}'. +tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts(16,9): error TS2322: Type 'number' is not assignable to type '() => unknown'. ==== tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts (1 errors) ==== @@ -19,8 +19,8 @@ tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts(16,9): error T }, baz: 42 ~~~ -!!! error TS2322: Type 'number' is not assignable to type '() => {}'. -!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts:16:9: The expected type comes from property 'baz' which is declared here on type 'ComputedOf<{ bar: number; baz: {}; }>' +!!! error TS2322: Type 'number' is not assignable to type '() => unknown'. +!!! related TS6500 tests/cases/conformance/types/mapped/mappedTypeInferenceErrors.ts:16:9: The expected type comes from property 'baz' which is declared here on type 'ComputedOf<{ bar: number; baz: unknown; }>' } }); \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeRecursiveInference.errors.txt b/tests/baselines/reference/mappedTypeRecursiveInference.errors.txt index c0916c0a6c8..f58b3cd61c0 100644 --- a/tests/baselines/reference/mappedTypeRecursiveInference.errors.txt +++ b/tests/baselines/reference/mappedTypeRecursiveInference.errors.txt @@ -1,8 +1,8 @@ -error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: {}; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: {}; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: {}; getAllResponseHeaders: {}; getResponseHeader: {}; open: {}; overrideMimeType: {}; send: {}; setRequestHeader: {}; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: {}; removeEventListener: {}; onabort: {}; onerror: {}; onload: {}; onloadend: {}; onloadstart: {}; onprogress: {}; ontimeout: {}; dispatchEvent: {}; }>'. -tests/cases/compiler/mappedTypeRecursiveInference.ts(19,18): error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: {}; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: {}; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: {}; getAllResponseHeaders: {}; getResponseHeader: {}; open: {}; overrideMimeType: {}; send: {}; setRequestHeader: {}; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: {}; removeEventListener: {}; onabort: {}; onerror: {}; onload: {}; onloadend: {}; onloadstart: {}; onprogress: {}; ontimeout: {}; dispatchEvent: {}; }>'. +error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: unknown; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: unknown; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: unknown; getAllResponseHeaders: unknown; getResponseHeader: unknown; open: unknown; overrideMimeType: unknown; send: unknown; setRequestHeader: unknown; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: unknown; removeEventListener: unknown; onabort: unknown; onerror: unknown; onload: unknown; onloadend: unknown; onloadstart: unknown; onprogress: unknown; ontimeout: unknown; dispatchEvent: unknown; }>'. +tests/cases/compiler/mappedTypeRecursiveInference.ts(19,18): error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: unknown; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: unknown; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: unknown; getAllResponseHeaders: unknown; getResponseHeader: unknown; open: unknown; overrideMimeType: unknown; send: unknown; setRequestHeader: unknown; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: unknown; removeEventListener: unknown; onabort: unknown; onerror: unknown; onload: unknown; onloadend: unknown; onloadstart: unknown; onprogress: unknown; ontimeout: unknown; dispatchEvent: unknown; }>'. -!!! error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: {}; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: {}; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: {}; getAllResponseHeaders: {}; getResponseHeader: {}; open: {}; overrideMimeType: {}; send: {}; setRequestHeader: {}; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: {}; removeEventListener: {}; onabort: {}; onerror: {}; onload: {}; onloadend: {}; onloadstart: {}; onprogress: {}; ontimeout: {}; dispatchEvent: {}; }>'. +!!! error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: unknown; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: unknown; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: unknown; getAllResponseHeaders: unknown; getResponseHeader: unknown; open: unknown; overrideMimeType: unknown; send: unknown; setRequestHeader: unknown; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: unknown; removeEventListener: unknown; onabort: unknown; onerror: unknown; onload: unknown; onloadend: unknown; onloadstart: unknown; onprogress: unknown; ontimeout: unknown; dispatchEvent: unknown; }>'. ==== tests/cases/compiler/mappedTypeRecursiveInference.ts (1 errors) ==== interface A { a: A } declare let a: A; @@ -24,7 +24,7 @@ tests/cases/compiler/mappedTypeRecursiveInference.ts(19,18): error TS2321: Exces let xhr: XMLHttpRequest; const out2 = foo(xhr); ~~~ -!!! error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: {}; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: {}; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: {}; getAllResponseHeaders: {}; getResponseHeader: {}; open: {}; overrideMimeType: {}; send: {}; setRequestHeader: {}; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: {}; removeEventListener: {}; onabort: {}; onerror: {}; onload: {}; onloadend: {}; onloadstart: {}; onprogress: {}; ontimeout: {}; dispatchEvent: {}; }>'. +!!! error TS2321: Excessive stack depth comparing types 'XMLHttpRequest' and 'Deep<{ onreadystatechange: unknown; readonly readyState: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly response: unknown; readonly responseText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; responseType: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseURL: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; readonly responseXML: { readonly URL: any; readonly activeElement: any; alinkColor: any; readonly all: any; readonly anchors: any; readonly applets: any; bgColor: any; body: any; readonly characterSet: any; readonly charset: any; readonly compatMode: any; readonly contentType: any; cookie: any; readonly currentScript: any; readonly defaultView: any; designMode: any; dir: any; readonly doctype: any; readonly documentElement: any; readonly documentURI: any; domain: any; readonly embeds: any; fgColor: any; readonly forms: any; readonly fullscreen: any; readonly fullscreenEnabled: any; readonly head: any; readonly hidden: any; readonly images: any; readonly implementation: any; readonly inputEncoding: any; readonly lastModified: any; linkColor: any; readonly links: any; location: any; onfullscreenchange: any; onfullscreenerror: any; onpointerlockchange: any; onpointerlockerror: any; onreadystatechange: any; onvisibilitychange: any; readonly origin: any; readonly plugins: any; readonly readyState: any; readonly referrer: any; readonly scripts: any; readonly scrollingElement: any; readonly timeline: any; title: any; readonly visibilityState: any; vlinkColor: any; adoptNode: any; captureEvents: any; caretPositionFromPoint: any; caretRangeFromPoint: any; clear: any; close: any; createAttribute: any; createAttributeNS: any; createCDATASection: any; createComment: any; createDocumentFragment: any; createElement: any; createElementNS: any; createEvent: any; createNodeIterator: any; createProcessingInstruction: any; createRange: any; createTextNode: any; createTouch: any; createTouchList: any; createTreeWalker: any; elementFromPoint: any; elementsFromPoint: any; evaluate: any; execCommand: any; exitFullscreen: any; exitPointerLock: any; getAnimations: any; getElementById: any; getElementsByClassName: any; getElementsByName: any; getElementsByTagName: any; getElementsByTagNameNS: any; getSelection: any; hasFocus: any; importNode: any; open: any; queryCommandEnabled: any; queryCommandIndeterm: any; queryCommandState: any; queryCommandSupported: any; queryCommandValue: any; releaseEvents: any; write: any; writeln: any; addEventListener: any; removeEventListener: any; readonly baseURI: any; readonly childNodes: any; readonly firstChild: any; readonly isConnected: any; readonly lastChild: any; readonly namespaceURI: any; readonly nextSibling: any; readonly nodeName: any; readonly nodeType: any; nodeValue: any; readonly ownerDocument: any; readonly parentElement: any; readonly parentNode: any; readonly previousSibling: any; textContent: any; appendChild: any; cloneNode: any; compareDocumentPosition: any; contains: any; getRootNode: any; hasChildNodes: any; insertBefore: any; isDefaultNamespace: any; isEqualNode: any; isSameNode: any; lookupNamespaceURI: any; lookupPrefix: any; normalize: any; removeChild: any; replaceChild: any; readonly ATTRIBUTE_NODE: any; readonly CDATA_SECTION_NODE: any; readonly COMMENT_NODE: any; readonly DOCUMENT_FRAGMENT_NODE: any; readonly DOCUMENT_NODE: any; readonly DOCUMENT_POSITION_CONTAINED_BY: any; readonly DOCUMENT_POSITION_CONTAINS: any; readonly DOCUMENT_POSITION_DISCONNECTED: any; readonly DOCUMENT_POSITION_FOLLOWING: any; readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: any; readonly DOCUMENT_POSITION_PRECEDING: any; readonly DOCUMENT_TYPE_NODE: any; readonly ELEMENT_NODE: any; readonly ENTITY_NODE: any; readonly ENTITY_REFERENCE_NODE: any; readonly NOTATION_NODE: any; readonly PROCESSING_INSTRUCTION_NODE: any; readonly TEXT_NODE: any; dispatchEvent: any; readonly fullscreenElement: any; readonly pointerLockElement: any; readonly styleSheets: any; readonly childElementCount: any; readonly children: any; readonly firstElementChild: any; readonly lastElementChild: any; append: any; prepend: any; querySelector: any; querySelectorAll: any; onabort: any; onanimationcancel: any; onanimationend: any; onanimationiteration: any; onanimationstart: any; onauxclick: any; onblur: any; oncancel: any; oncanplay: any; oncanplaythrough: any; onchange: any; onclick: any; onclose: any; oncontextmenu: any; oncuechange: any; ondblclick: any; ondrag: any; ondragend: any; ondragenter: any; ondragexit: any; ondragleave: any; ondragover: any; ondragstart: any; ondrop: any; ondurationchange: any; onemptied: any; onended: any; onerror: any; onfocus: any; ongotpointercapture: any; oninput: any; oninvalid: any; onkeydown: any; onkeypress: any; onkeyup: any; onload: any; onloadeddata: any; onloadedmetadata: any; onloadend: any; onloadstart: any; onlostpointercapture: any; onmousedown: any; onmouseenter: any; onmouseleave: any; onmousemove: any; onmouseout: any; onmouseover: any; onmouseup: any; onpause: any; onplay: any; onplaying: any; onpointercancel: any; onpointerdown: any; onpointerenter: any; onpointerleave: any; onpointermove: any; onpointerout: any; onpointerover: any; onpointerup: any; onprogress: any; onratechange: any; onreset: any; onresize: any; onscroll: any; onsecuritypolicyviolation: any; onseeked: any; onseeking: any; onselect: any; onselectionchange: any; onselectstart: any; onstalled: any; onsubmit: any; onsuspend: any; ontimeupdate: any; ontoggle: any; ontouchcancel: any; ontouchend: any; ontouchmove: any; ontouchstart: any; ontransitioncancel: any; ontransitionend: any; ontransitionrun: any; ontransitionstart: any; onvolumechange: any; onwaiting: any; onwheel: any; oncopy: any; oncut: any; onpaste: any; }; readonly status: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly statusText: { toString: any; charAt: any; charCodeAt: any; concat: any; indexOf: any; lastIndexOf: any; localeCompare: any; match: any; replace: any; search: any; slice: any; split: any; substring: any; toLowerCase: any; toLocaleLowerCase: any; toUpperCase: any; toLocaleUpperCase: any; trim: any; readonly length: any; substr: any; valueOf: any; codePointAt: any; includes: any; endsWith: any; normalize: any; repeat: any; startsWith: any; anchor: any; big: any; blink: any; bold: any; fixed: any; fontcolor: any; fontsize: any; italics: any; link: any; small: any; strike: any; sub: any; sup: any; [Symbol.iterator]: any; }; timeout: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly upload: { addEventListener: any; removeEventListener: any; onabort: any; onerror: any; onload: any; onloadend: any; onloadstart: any; onprogress: any; ontimeout: any; dispatchEvent: any; }; withCredentials: { valueOf: any; }; abort: unknown; getAllResponseHeaders: unknown; getResponseHeader: unknown; open: unknown; overrideMimeType: unknown; send: unknown; setRequestHeader: unknown; readonly DONE: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly HEADERS_RECEIVED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly LOADING: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly OPENED: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; readonly UNSENT: { toString: any; toFixed: any; toExponential: any; toPrecision: any; valueOf: any; toLocaleString: any; }; addEventListener: unknown; removeEventListener: unknown; onabort: unknown; onerror: unknown; onload: unknown; onloadend: unknown; onloadstart: unknown; onprogress: unknown; ontimeout: unknown; dispatchEvent: unknown; }>'. out2.responseXML out2.responseXML.activeElement.className.length \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types index 4bfd9b37441..c32e6590156 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types @@ -133,13 +133,13 @@ o.hasOwnProperty(Symbol.hasInstance); // Using ES6 promise async function out() { ->out : () => Promise<{}> +>out : () => Promise return new Promise(function (resolve, reject) {}); ->new Promise(function (resolve, reject) {}) : Promise<{}> +>new Promise(function (resolve, reject) {}) : Promise >Promise : PromiseConstructor ->function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void ->resolve : (value?: {} | PromiseLike<{}>) => void +>function (resolve, reject) {} : (resolve: (value?: unknown) => void, reject: (reason?: any) => void) => void +>resolve : (value?: unknown) => void >reject : (reason?: any) => void } @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise ->out() : Promise<{}> ->out : () => Promise<{}> ->then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out().then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out() : Promise +>out : () => Promise +>then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types index cfc9dd39823..a8dd60b1f8c 100644 --- a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types @@ -133,13 +133,13 @@ o.hasOwnProperty(Symbol.hasInstance); // Using ES6 promise async function out() { ->out : () => Promise<{}> +>out : () => Promise return new Promise(function (resolve, reject) {}); ->new Promise(function (resolve, reject) {}) : Promise<{}> +>new Promise(function (resolve, reject) {}) : Promise >Promise : PromiseConstructor ->function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void ->resolve : (value?: {} | PromiseLike<{}>) => void +>function (resolve, reject) {} : (resolve: (value?: unknown) => void, reject: (reason?: any) => void) => void +>resolve : (value?: unknown) => void >reject : (reason?: any) => void } @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise ->out() : Promise<{}> ->out : () => Promise<{}> ->then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out().then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out() : Promise +>out : () => Promise +>then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types index f9203bbc639..222c5ab0c11 100644 --- a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types @@ -133,13 +133,13 @@ o.hasOwnProperty(Symbol.hasInstance); // Using ES6 promise async function out() { ->out : () => Promise<{}> +>out : () => Promise return new Promise(function (resolve, reject) {}); ->new Promise(function (resolve, reject) {}) : Promise<{}> +>new Promise(function (resolve, reject) {}) : Promise >Promise : PromiseConstructor ->function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void ->resolve : (value?: {} | PromiseLike<{}>) => void +>function (resolve, reject) {} : (resolve: (value?: unknown) => void, reject: (reason?: any) => void) => void +>resolve : (value?: unknown) => void >reject : (reason?: any) => void } @@ -148,10 +148,10 @@ declare var console: any; out().then(() => { >out().then(() => { console.log("Yea!");}) : Promise ->out().then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise ->out() : Promise<{}> ->out : () => Promise<{}> ->then : (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out().then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise +>out() : Promise +>out : () => Promise +>then : (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike) => Promise >() => { console.log("Yea!");} : () => void console.log("Yea!"); diff --git a/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt b/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt index 0682caad5b8..bb90bcee999 100644 --- a/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt +++ b/tests/baselines/reference/mutuallyRecursiveCallbacks.errors.txt @@ -1,9 +1,9 @@ tests/cases/compiler/mutuallyRecursiveCallbacks.ts(7,1): error TS2322: Type '(bar: Bar) => void' is not assignable to type 'Bar<{}>'. Types of parameters 'bar' and 'foo' are incompatible. Types of parameters 'bar' and 'foo' are incompatible. - Type 'Foo<{}>' is not assignable to type 'Bar<{}>'. + Type 'Foo' is not assignable to type 'Bar<{}>'. Types of parameters 'bar' and 'foo' are incompatible. - Type 'void' is not assignable to type 'Foo<{}>'. + Type 'void' is not assignable to type 'Foo'. ==== tests/cases/compiler/mutuallyRecursiveCallbacks.ts (1 errors) ==== @@ -18,7 +18,7 @@ tests/cases/compiler/mutuallyRecursiveCallbacks.ts(7,1): error TS2322: Type ' !!! error TS2322: Type '(bar: Bar) => void' is not assignable to type 'Bar<{}>'. !!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible. !!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible. -!!! error TS2322: Type 'Foo<{}>' is not assignable to type 'Bar<{}>'. +!!! error TS2322: Type 'Foo' is not assignable to type 'Bar<{}>'. !!! error TS2322: Types of parameters 'bar' and 'foo' are incompatible. -!!! error TS2322: Type 'void' is not assignable to type 'Foo<{}>'. +!!! error TS2322: Type 'void' is not assignable to type 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt index 4ba7f6ba09e..70b04d26580 100644 --- a/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt +++ b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts(13,17): error TS2345: Argument of type 'B' is not assignable to parameter of type 'A<{}>'. - Property 'a' is missing in type 'B' but required in type 'A<{}>'. +tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts(13,17): error TS2345: Argument of type 'B' is not assignable to parameter of type 'A'. + Property 'a' is missing in type 'B' but required in type 'A'. ==== tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts (1 errors) ==== @@ -17,8 +17,8 @@ tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeF if (x instanceof B) { acceptA(x); ~ -!!! error TS2345: Argument of type 'B' is not assignable to parameter of type 'A<{}>'. -!!! error TS2345: Property 'a' is missing in type 'B' but required in type 'A<{}>'. +!!! error TS2345: Argument of type 'B' is not assignable to parameter of type 'A'. +!!! error TS2345: Property 'a' is missing in type 'B' but required in type 'A'. !!! related TS2728 tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts:2:17: 'a' is declared here. } diff --git a/tests/baselines/reference/newOperatorConformance.types b/tests/baselines/reference/newOperatorConformance.types index 242ef19bd85..d7755c3b8ef 100644 --- a/tests/baselines/reference/newOperatorConformance.types +++ b/tests/baselines/reference/newOperatorConformance.types @@ -50,12 +50,12 @@ var a: C0; // Generic construct expression with no parentheses var c1 = new T; ->c1 : T<{}> ->new T : T<{}> +>c1 : T +>new T : T >T : typeof T var c1: T<{}>; ->c1 : T<{}> +>c1 : T // Construct expression where constructor is of type 'any' with no parentheses var d = new anyCtor; diff --git a/tests/baselines/reference/newOperatorErrorCases.types b/tests/baselines/reference/newOperatorErrorCases.types index 1813b581c00..dd2d57413fa 100644 --- a/tests/baselines/reference/newOperatorErrorCases.types +++ b/tests/baselines/reference/newOperatorErrorCases.types @@ -49,12 +49,12 @@ var b = new C0 32, ''; // Parse error // Generic construct expression with no parentheses var c1 = new T; ->c1 : T<{}> ->new T : T<{}> +>c1 : T +>new T : T >T : typeof T var c1: T<{}>; ->c1 : T<{}> +>c1 : T var c2 = new T; // Parse error >c2 : T diff --git a/tests/baselines/reference/objectLiteralContextualTyping.errors.txt b/tests/baselines/reference/objectLiteralContextualTyping.errors.txt new file mode 100644 index 00000000000..b73b7b43a89 --- /dev/null +++ b/tests/baselines/reference/objectLiteralContextualTyping.errors.txt @@ -0,0 +1,36 @@ +tests/cases/conformance/expressions/contextualTyping/objectLiteralContextualTyping.ts(29,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'unknown', but here has type '{}'. + + +==== tests/cases/conformance/expressions/contextualTyping/objectLiteralContextualTyping.ts (1 errors) ==== + // In a contextually typed object literal, each property value expression is contextually typed by + // the type of the property with a matching name in the contextual type, if any, or otherwise + // for a numerically named property, the numeric index type of the contextual type, if any, or otherwise + // the string index type of the contextual type, if any. + + interface Item { + name: string; + description?: string; + } + + declare function foo(item: Item): string; + declare function foo(item: any): number; + + var x = foo({ name: "Sprocket" }); + var x: string; + + var y = foo({ name: "Sprocket", description: "Bumpy wheel" }); + var y: string; + + var z = foo({ name: "Sprocket", description: false }); + var z: number; + + var w = foo({ a: 10 }); + var w: number; + + declare function bar(param: { x?: T }): T; + + var b = bar({}); + var b: {}; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'unknown', but here has type '{}'. + \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralContextualTyping.types b/tests/baselines/reference/objectLiteralContextualTyping.types index 357ed863ab6..d2982298ad9 100644 --- a/tests/baselines/reference/objectLiteralContextualTyping.types +++ b/tests/baselines/reference/objectLiteralContextualTyping.types @@ -74,11 +74,11 @@ declare function bar(param: { x?: T }): T; >x : T var b = bar({}); ->b : {} ->bar({}) : {} +>b : unknown +>bar({}) : unknown >bar : (param: { x?: T; }) => T >{} : {} var b: {}; ->b : {} +>b : unknown diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.types b/tests/baselines/reference/overloadResolutionClassConstructors.types index 65adbe6c669..a1f86b9a972 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.types +++ b/tests/baselines/reference/overloadResolutionClassConstructors.types @@ -94,7 +94,7 @@ new fn2('', 0); // OK // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments new fn2('', 0); // OK ->new fn2('', 0) : fn2<{}> +>new fn2('', 0) : fn2 >fn2 : typeof fn2 >'' : "" >0 : 0 @@ -120,12 +120,12 @@ class fn3 { } new fn3(3); ->new fn3(3) : fn3 +>new fn3(3) : fn3 >fn3 : typeof fn3 >3 : 3 new fn3('', 3, ''); ->new fn3('', 3, '') : fn3 +>new fn3('', 3, '') : fn3 >fn3 : typeof fn3 >'' : "" >3 : 3 diff --git a/tests/baselines/reference/parameterReferenceInInitializer1.types b/tests/baselines/reference/parameterReferenceInInitializer1.types index 16924d311a4..3ea9bd81b03 100644 --- a/tests/baselines/reference/parameterReferenceInInitializer1.types +++ b/tests/baselines/reference/parameterReferenceInInitializer1.types @@ -20,8 +20,8 @@ class C { >y : Y public x = fn(y, (y, x) => y.x = x) // expected to work, but actually doesn't ->x : {} ->fn(y, (y, x) => y.x = x) : {} +>x : unknown +>fn(y, (y, x) => y.x = x) : unknown >fn : (y: Y, set: (y: Y, x: number) => void) => a >y : Y >(y, x) => y.x = x : (y: Y, x: number) => number diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types index bebee723fc9..9920cac1b43 100644 --- a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter.types @@ -19,13 +19,13 @@ module Query { } function fromOrderBy() { ->fromOrderBy : () => Iterator<{}> +>fromOrderBy : () => Iterator return fromDoWhile(test => { ->fromDoWhile(test => { return true; }) : Iterator<{}> +>fromDoWhile(test => { return true; }) : Iterator >fromDoWhile : (doWhile: (test: Iterator) => boolean) => Iterator ->test => { return true; } : (test: Iterator<{}>) => true ->test : Iterator<{}> +>test => { return true; } : (test: Iterator) => true +>test : Iterator return true; >true : true diff --git a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types index db5ef5ee38d..a14f69145c8 100644 --- a/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types +++ b/tests/baselines/reference/privacyCheckAnonymousFunctionParameter2.types @@ -26,7 +26,7 @@ module Q { >bar : () => void foo(null); ->foo(null) : (a: Iterator<{}>) => number +>foo(null) : (a: Iterator) => number >foo : (x: (a: Iterator) => number) => (a: Iterator) => number >null : null } diff --git a/tests/baselines/reference/promisePermutations.types b/tests/baselines/reference/promisePermutations.types index 8020dba47a8..0dbe5f7ec0e 100644 --- a/tests/baselines/reference/promisePermutations.types +++ b/tests/baselines/reference/promisePermutations.types @@ -1018,19 +1018,19 @@ var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, >sIPromise : (x: any) => IPromise var r10 = testFunction10(x => x); ->r10 : IPromise<{}> ->testFunction10(x => x) : IPromise<{}> +>r10 : IPromise +>testFunction10(x => x) : IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >x => x : (x: U) => U >x : U >x : U var r10a = r10.then(testFunction10, testFunction10, testFunction10); // ok ->r10a : IPromise<{}> ->r10.then(testFunction10, testFunction10, testFunction10) : IPromise<{}> ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10a : IPromise +>r10.then(testFunction10, testFunction10, testFunction10) : IPromise +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise @@ -1038,9 +1038,9 @@ var r10a = r10.then(testFunction10, testFunction10, testFunction10); // ok var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok >r10b : IPromise >r10.then(sIPromise, sIPromise, sIPromise) : IPromise ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >sIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1048,9 +1048,9 @@ var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok >r10c : IPromise >r10.then(nIPromise, nIPromise, nIPromise) : IPromise ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >nIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1058,9 +1058,9 @@ var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // ok >r10d : any >r10.then(testFunction, sIPromise, nIPromise) : any ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >testFunction : () => IPromise >sIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1070,9 +1070,9 @@ var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromis >r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise) : IPromise >r10.then(testFunction, nIPromise, sIPromise).then : { (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >r10.then(testFunction, nIPromise, sIPromise) : IPromise ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >testFunction : () => IPromise >nIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1082,39 +1082,39 @@ var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromis >sIPromise : (x: any) => IPromise var s10 = testFunction10P(x => x); ->s10 : Promise<{}> ->testFunction10P(x => x) : Promise<{}> +>s10 : Promise +>testFunction10P(x => x) : Promise >testFunction10P : (cb: (a: U) => U) => Promise >x => x : (x: U) => U >x : U >x : U var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok ->s10a : Promise> ->s10.then(testFunction10, testFunction10, testFunction10) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10a : Promise> +>s10.then(testFunction10, testFunction10, testFunction10) : Promise> +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise var s10b = s10.then(testFunction10P, testFunction10P, testFunction10P); // ok ->s10b : Promise<{}> ->s10.then(testFunction10P, testFunction10P, testFunction10P) : Promise<{}> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10b : Promise +>s10.then(testFunction10P, testFunction10P, testFunction10P) : Promise +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10P : (cb: (a: U) => U) => Promise var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok ->s10c : Promise<{}> ->s10.then(testFunction10P, testFunction10, testFunction10) : Promise<{}> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10c : Promise +>s10.then(testFunction10P, testFunction10, testFunction10) : Promise +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise @@ -1122,9 +1122,9 @@ var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok var s10d = s10.then(sPromise, sPromise, sPromise); // ok >s10d : Promise >s10.then(sPromise, sPromise, sPromise) : Promise ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >sPromise : (x: any) => Promise >sPromise : (x: any) => Promise >sPromise : (x: any) => Promise @@ -1132,9 +1132,9 @@ var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok >s10e : Promise> >s10.then(nIPromise, nPromise, nIPromise) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >nIPromise : (x: any) => IPromise >nPromise : (x: any) => Promise >nIPromise : (x: any) => IPromise @@ -1142,9 +1142,9 @@ var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error >s10f : any >s10.then(testFunctionP, sIPromise, nIPromise) : any ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunctionP : () => Promise >sIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1154,9 +1154,9 @@ var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromis >s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise) : Promise> >s10.then(testFunctionP, nIPromise, sIPromise).then : { , TResult2 = never>(onfulfilled?: (value: IPromise) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: IPromise) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: IPromise) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: IPromise) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: IPromise) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >s10.then(testFunctionP, nIPromise, sIPromise) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunctionP : () => Promise >nIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1220,8 +1220,8 @@ var r12 = testFunction12(x => x); >x : any var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok ->r12a : IPromise<{}> ->r12.then(testFunction12, testFunction12, testFunction12) : IPromise<{}> +>r12a : IPromise +>r12.then(testFunction12, testFunction12, testFunction12) : IPromise >r12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >r12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } @@ -1238,8 +1238,8 @@ var s12 = testFunction12(x => x); >x : any var s12a = s12.then(testFunction12, testFunction12, testFunction12); // ok ->s12a : IPromise<{}> ->s12.then(testFunction12, testFunction12, testFunction12) : IPromise<{}> +>s12a : IPromise +>s12.then(testFunction12, testFunction12, testFunction12) : IPromise >s12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >s12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } @@ -1248,8 +1248,8 @@ var s12a = s12.then(testFunction12, testFunction12, testFunction12); // ok >testFunction12 : { (x: T): IPromise; (x: T, y: T): IPromise; } var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok ->s12b : IPromise<{}> ->s12.then(testFunction12P, testFunction12P, testFunction12P) : IPromise<{}> +>s12b : IPromise +>s12.then(testFunction12P, testFunction12P, testFunction12P) : IPromise >s12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >s12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } @@ -1258,8 +1258,8 @@ var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok >testFunction12P : { (x: T): IPromise; (x: T, y: T): Promise; } var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok ->s12c : IPromise<{}> ->s12.then(testFunction12P, testFunction12, testFunction12) : IPromise<{}> +>s12c : IPromise +>s12.then(testFunction12P, testFunction12, testFunction12) : IPromise >s12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >s12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } diff --git a/tests/baselines/reference/promisePermutations2.types b/tests/baselines/reference/promisePermutations2.types index 743565a600b..957b548a284 100644 --- a/tests/baselines/reference/promisePermutations2.types +++ b/tests/baselines/reference/promisePermutations2.types @@ -993,19 +993,19 @@ var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, >sIPromise : (x: any) => IPromise var r10 = testFunction10(x => x); ->r10 : IPromise<{}> ->testFunction10(x => x) : IPromise<{}> +>r10 : IPromise +>testFunction10(x => x) : IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >x => x : (x: U) => U >x : U >x : U var r10a = r10.then(testFunction10, testFunction10, testFunction10); // ok ->r10a : IPromise<{}> ->r10.then(testFunction10, testFunction10, testFunction10) : IPromise<{}> ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10a : IPromise +>r10.then(testFunction10, testFunction10, testFunction10) : IPromise +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise @@ -1013,9 +1013,9 @@ var r10a = r10.then(testFunction10, testFunction10, testFunction10); // ok var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok >r10b : IPromise >r10.then(sIPromise, sIPromise, sIPromise) : IPromise ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >sIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1023,9 +1023,9 @@ var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok >r10c : IPromise >r10.then(nIPromise, nIPromise, nIPromise) : IPromise ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >nIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1033,9 +1033,9 @@ var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // error >r10d : any >r10.then(testFunction, sIPromise, nIPromise) : any ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >testFunction : () => IPromise >sIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1045,9 +1045,9 @@ var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromis >r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise) : IPromise >r10.then(testFunction, nIPromise, sIPromise).then : { (success?: (value: number) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: number) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >r10.then(testFunction, nIPromise, sIPromise) : IPromise ->r10.then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } ->r10 : IPromise<{}> ->then : { (success?: (value: {}) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10.then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } +>r10 : IPromise +>then : { (success?: (value: unknown) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >testFunction : () => IPromise >nIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1057,39 +1057,39 @@ var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromis >sIPromise : (x: any) => IPromise var s10 = testFunction10P(x => x); ->s10 : Promise<{}> ->testFunction10P(x => x) : Promise<{}> +>s10 : Promise +>testFunction10P(x => x) : Promise >testFunction10P : (cb: (a: U) => U) => Promise >x => x : (x: U) => U >x : U >x : U var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok ->s10a : Promise> ->s10.then(testFunction10, testFunction10, testFunction10) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10a : Promise> +>s10.then(testFunction10, testFunction10, testFunction10) : Promise> +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise var s10b = s10.then(testFunction10P, testFunction10P, testFunction10P); // ok ->s10b : Promise> ->s10.then(testFunction10P, testFunction10P, testFunction10P) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10b : Promise> +>s10.then(testFunction10P, testFunction10P, testFunction10P) : Promise> +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10P : (cb: (a: U) => U) => Promise var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok ->s10c : Promise> ->s10.then(testFunction10P, testFunction10, testFunction10) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10c : Promise> +>s10.then(testFunction10P, testFunction10, testFunction10) : Promise> +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise @@ -1097,9 +1097,9 @@ var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok var s10d = s10.then(sPromise, sPromise, sPromise); // ok >s10d : Promise> >s10.then(sPromise, sPromise, sPromise) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >sPromise : (x: any) => Promise >sPromise : (x: any) => Promise >sPromise : (x: any) => Promise @@ -1107,9 +1107,9 @@ var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok >s10e : Promise> >s10.then(nIPromise, nPromise, nIPromise) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >nIPromise : (x: any) => IPromise >nPromise : (x: any) => Promise >nIPromise : (x: any) => IPromise @@ -1117,9 +1117,9 @@ var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error >s10f : any >s10.then(testFunctionP, sIPromise, nIPromise) : any ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunctionP : () => Promise >sIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1129,9 +1129,9 @@ var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromis >s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise) : Promise> >s10.then(testFunctionP, nIPromise, sIPromise).then : { , TResult2 = never>(onfulfilled?: (value: IPromise) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: IPromise) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >s10.then(testFunctionP, nIPromise, sIPromise) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunctionP : () => Promise >nIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1195,8 +1195,8 @@ var r12 = testFunction12(x => x); >x : any var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok ->r12a : IPromise<{}> ->r12.then(testFunction12, testFunction12, testFunction12) : IPromise<{}> +>r12a : IPromise +>r12.then(testFunction12, testFunction12, testFunction12) : IPromise >r12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >r12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } @@ -1213,8 +1213,8 @@ var s12 = testFunction12(x => x); >x : any var s12a = s12.then(testFunction12, testFunction12, testFunction12); // ok ->s12a : IPromise<{}> ->s12.then(testFunction12, testFunction12, testFunction12) : IPromise<{}> +>s12a : IPromise +>s12.then(testFunction12, testFunction12, testFunction12) : IPromise >s12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >s12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } @@ -1223,8 +1223,8 @@ var s12a = s12.then(testFunction12, testFunction12, testFunction12); // ok >testFunction12 : { (x: T): IPromise; (x: T, y: T): IPromise; } var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok ->s12b : IPromise<{}> ->s12.then(testFunction12P, testFunction12P, testFunction12P) : IPromise<{}> +>s12b : IPromise +>s12.then(testFunction12P, testFunction12P, testFunction12P) : IPromise >s12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >s12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } @@ -1233,8 +1233,8 @@ var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok >testFunction12P : { (x: T): IPromise; (x: T, y: T): Promise; } var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok ->s12c : IPromise<{}> ->s12.then(testFunction12P, testFunction12, testFunction12) : IPromise<{}> +>s12c : IPromise +>s12.then(testFunction12P, testFunction12, testFunction12) : IPromise >s12.then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } >s12 : IPromise<(x: any) => any> >then : { (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => IPromise, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => IPromise, progress?: (progress: any) => void): IPromise; (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void): IPromise; } diff --git a/tests/baselines/reference/promisePermutations3.errors.txt b/tests/baselines/reference/promisePermutations3.errors.txt index 7f12ee8609a..83a161af960 100644 --- a/tests/baselines/reference/promisePermutations3.errors.txt +++ b/tests/baselines/reference/promisePermutations3.errors.txt @@ -65,8 +65,8 @@ tests/cases/compiler/promisePermutations3.ts(159,21): error TS2345: Argument of Types of parameters 'onfulfilled' and 'success' are incompatible. 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<{}>'. - Property 'catch' is missing in type 'IPromise' but required in type 'Promise<{}>'. +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'. + Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. ==== tests/cases/compiler/promisePermutations3.ts (35 errors) ==== @@ -338,7 +338,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of var s12a = s12.then(testFunction12, testFunction12, testFunction12); // ok var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok ~~~~~~~~~~~~~~~ -!!! 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<{}>'. -!!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise<{}>'. +!!! 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'. +!!! error TS2345: Property 'catch' is missing in type 'IPromise' but required in type 'Promise'. !!! related TS2728 /.ts/lib.es5.d.ts:1413:5: 'catch' is declared here. var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok \ No newline at end of file diff --git a/tests/baselines/reference/promisePermutations3.types b/tests/baselines/reference/promisePermutations3.types index f8bf272e552..a643b89b23b 100644 --- a/tests/baselines/reference/promisePermutations3.types +++ b/tests/baselines/reference/promisePermutations3.types @@ -993,19 +993,19 @@ var s9g = s9.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, >sIPromise : (x: any) => IPromise var r10 = testFunction10(x => x); ->r10 : IPromise<{}> ->testFunction10(x => x) : IPromise<{}> +>r10 : IPromise +>testFunction10(x => x) : IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >x => x : (x: U) => U >x : U >x : U var r10a = r10.then(testFunction10, testFunction10, testFunction10); // ok ->r10a : IPromise> ->r10.then(testFunction10, testFunction10, testFunction10) : IPromise> ->r10.then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise ->r10 : IPromise<{}> ->then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10a : IPromise> +>r10.then(testFunction10, testFunction10, testFunction10) : IPromise> +>r10.then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10 : IPromise +>then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise @@ -1013,9 +1013,9 @@ var r10a = r10.then(testFunction10, testFunction10, testFunction10); // ok var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok >r10b : IPromise> >r10.then(sIPromise, sIPromise, sIPromise) : IPromise> ->r10.then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise ->r10 : IPromise<{}> ->then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10.then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10 : IPromise +>then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >sIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1023,9 +1023,9 @@ var r10b = r10.then(sIPromise, sIPromise, sIPromise); // ok var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok >r10c : IPromise> >r10.then(nIPromise, nIPromise, nIPromise) : IPromise> ->r10.then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise ->r10 : IPromise<{}> ->then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10.then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10 : IPromise +>then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >nIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1033,9 +1033,9 @@ var r10c = r10.then(nIPromise, nIPromise, nIPromise); // ok var r10d = r10.then(testFunction, sIPromise, nIPromise); // error >r10d : any >r10.then(testFunction, sIPromise, nIPromise) : any ->r10.then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise ->r10 : IPromise<{}> ->then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10.then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10 : IPromise +>then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >testFunction : () => IPromise >sIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1045,9 +1045,9 @@ var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromis >r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromise, sIPromise) : IPromise> >r10.then(testFunction, nIPromise, sIPromise).then : (success?: (value: IPromise) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >r10.then(testFunction, nIPromise, sIPromise) : IPromise> ->r10.then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise ->r10 : IPromise<{}> ->then : (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10.then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise +>r10 : IPromise +>then : (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >testFunction : () => IPromise >nIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1057,39 +1057,39 @@ var r10e = r10.then(testFunction, nIPromise, sIPromise).then(sIPromise, sIPromis >sIPromise : (x: any) => IPromise var s10 = testFunction10P(x => x); ->s10 : Promise<{}> ->testFunction10P(x => x) : Promise<{}> +>s10 : Promise +>testFunction10P(x => x) : Promise >testFunction10P : (cb: (a: U) => U) => Promise >x => x : (x: U) => U >x : U >x : U var s10a = s10.then(testFunction10, testFunction10, testFunction10); // ok ->s10a : Promise> ->s10.then(testFunction10, testFunction10, testFunction10) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10a : Promise> +>s10.then(testFunction10, testFunction10, testFunction10) : Promise> +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise var s10b = s10.then(testFunction10P, testFunction10P, testFunction10P); // ok ->s10b : Promise<{}> ->s10.then(testFunction10P, testFunction10P, testFunction10P) : Promise<{}> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10b : Promise +>s10.then(testFunction10P, testFunction10P, testFunction10P) : Promise +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10P : (cb: (a: U) => U) => Promise var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok ->s10c : Promise<{}> ->s10.then(testFunction10P, testFunction10, testFunction10) : Promise<{}> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10c : Promise +>s10.then(testFunction10P, testFunction10, testFunction10) : Promise +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunction10P : (cb: (a: U) => U) => Promise >testFunction10 : (cb: (a: U) => U) => IPromise >testFunction10 : (cb: (a: U) => U) => IPromise @@ -1097,9 +1097,9 @@ var s10c = s10.then(testFunction10P, testFunction10, testFunction10); // ok var s10d = s10.then(sPromise, sPromise, sPromise); // ok >s10d : Promise >s10.then(sPromise, sPromise, sPromise) : Promise ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >sPromise : (x: any) => Promise >sPromise : (x: any) => Promise >sPromise : (x: any) => Promise @@ -1107,9 +1107,9 @@ var s10d = s10.then(sPromise, sPromise, sPromise); // ok var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok >s10e : Promise> >s10.then(nIPromise, nPromise, nIPromise) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >nIPromise : (x: any) => IPromise >nPromise : (x: any) => Promise >nIPromise : (x: any) => IPromise @@ -1117,9 +1117,9 @@ var s10e = s10.then(nIPromise, nPromise, nIPromise); // ok var s10f = s10.then(testFunctionP, sIPromise, nIPromise); // error >s10f : any >s10.then(testFunctionP, sIPromise, nIPromise) : any ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunctionP : () => Promise >sIPromise : (x: any) => IPromise >nIPromise : (x: any) => IPromise @@ -1129,9 +1129,9 @@ var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromis >s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise) : Promise> >s10.then(testFunctionP, nIPromise, sIPromise).then : { , TResult2 = never>(onfulfilled?: (value: IPromise) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: IPromise) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: IPromise) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: IPromise) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: IPromise) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >s10.then(testFunctionP, nIPromise, sIPromise) : Promise> ->s10.then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } ->s10 : Promise<{}> ->then : { (onfulfilled?: (value: {}) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: {}) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: {}) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10.then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } +>s10 : Promise +>then : { (onfulfilled?: (value: unknown) => TResult1 | PromiseLike, onrejected?: (reason: any) => TResult2 | PromiseLike): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => Promise, error?: (error: any) => U, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => Promise, progress?: (progress: any) => void): Promise; (success?: (value: unknown) => U, error?: (error: any) => U, progress?: (progress: any) => void): Promise; } >testFunctionP : () => Promise >nIPromise : (x: any) => IPromise >sIPromise : (x: any) => IPromise @@ -1195,8 +1195,8 @@ var r12 = testFunction12(x => x); >x : any var r12a = r12.then(testFunction12, testFunction12, testFunction12); // ok ->r12a : IPromise> ->r12.then(testFunction12, testFunction12, testFunction12) : IPromise> +>r12a : IPromise> +>r12.then(testFunction12, testFunction12, testFunction12) : IPromise> >r12.then : (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >r12 : IPromise<(x: any) => any> >then : (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise @@ -1213,8 +1213,8 @@ var s12 = testFunction12(x => x); >x : any var s12a = s12.then(testFunction12, testFunction12, testFunction12); // ok ->s12a : IPromise> ->s12.then(testFunction12, testFunction12, testFunction12) : IPromise> +>s12a : IPromise> +>s12.then(testFunction12, testFunction12, testFunction12) : IPromise> >s12.then : (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >s12 : IPromise<(x: any) => any> >then : (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise @@ -1233,8 +1233,8 @@ var s12b = s12.then(testFunction12P, testFunction12P, testFunction12P); // ok >testFunction12P : { (x: T): IPromise; (x: T, y: T): Promise; } var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok ->s12c : IPromise> ->s12.then(testFunction12P, testFunction12, testFunction12) : IPromise> +>s12c : IPromise> +>s12.then(testFunction12P, testFunction12, testFunction12) : IPromise> >s12.then : (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise >s12 : IPromise<(x: any) => any> >then : (success?: (value: (x: any) => any) => U, error?: (error: any) => U, progress?: (progress: any) => void) => IPromise diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.types b/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.types index 89e10b506c6..0d1f3a29fdd 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.types +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithoutConstraints.types @@ -68,7 +68,7 @@ var r3: string = a().toString(); >r3 : string >a().toString() : string >a().toString : () => string ->a() : {} +>a() : unknown >a : () => T >toString : () => string @@ -76,7 +76,7 @@ var r3b: string = a()['toString'](); >r3b : string >a()['toString']() : string >a()['toString'] : () => string ->a() : {} +>a() : unknown >a : () => T >'toString' : "toString" diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt new file mode 100644 index 00000000000..1c7b94a0463 --- /dev/null +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt @@ -0,0 +1,225 @@ +tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): error TS2344: Type 'GetProps' does not satisfy the constraint 'Shared>'. + Type 'unknown' is not assignable to type 'Shared>'. + Type 'Matching>' is not assignable to type 'Shared>'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[P] | (TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>] | (TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]) | GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] | GetProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string] | GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. + Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + + +==== tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts (1 errors) ==== + declare class Component

{ + constructor(props: Readonly

); + constructor(props: P, context?: any); + readonly props: Readonly

& Readonly<{ children?: {} }>; + } + interface ComponentClass

{ + new (props: P, context?: any): Component

; + propTypes?: WeakValidationMap

; + defaultProps?: Partial

; + displayName?: string; + } + interface FunctionComponent

{ + (props: P & { children?: {} }, context?: any): {} | null; + propTypes?: WeakValidationMap

; + defaultProps?: Partial

; + displayName?: string; + } + + declare const nominalTypeHack: unique symbol; + interface Validator { + ( + props: object, + propName: string, + componentName: string, + location: string, + propFullName: string + ): Error | null; + [nominalTypeHack]?: T; + } + type WeakValidationMap = { + [K in keyof T]?: null extends T[K] + ? Validator + : undefined extends T[K] + ? Validator + : Validator + }; + type ComponentType

= ComponentClass

| FunctionComponent

; + + type Shared< + InjectedProps, + DecorationTargetProps extends Shared + > = { + [P in Extract< + keyof InjectedProps, + keyof DecorationTargetProps + >]?: InjectedProps[P] extends DecorationTargetProps[P] + ? DecorationTargetProps[P] + : never + }; + + // Infers prop type from component C + type GetProps = C extends ComponentType ? P : never; + + type ConnectedComponentClass, P> = ComponentClass< + P + > & { + WrappedComponent: C; + }; + + type Matching = { + [P in keyof DecorationTargetProps]: P extends keyof InjectedProps + ? InjectedProps[P] extends DecorationTargetProps[P] + ? DecorationTargetProps[P] + : InjectedProps[P] + : DecorationTargetProps[P] + }; + + type Omit = Pick>; + + type InferableComponentEnhancerWithProps = < + C extends ComponentType>> + >( + component: C + ) => ConnectedComponentClass< + C, + Omit, keyof Shared>> & TNeedsProps + ~~~~~~~~~~~ +!!! error TS2344: Type 'GetProps' does not satisfy the constraint 'Shared>'. +!!! error TS2344: Type 'unknown' is not assignable to type 'Shared>'. +!!! error TS2344: Type 'Matching>' is not assignable to type 'Shared>'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[P] | (TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[P]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>] | (TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type '(Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]) | (Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>])' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]) | GetProps[Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] | GetProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]) | GetProps[keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] | GetProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type '(TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]) | GetProps[string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] | GetProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type '(TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never) | undefined'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & string] extends GetProps[keyof TInjectedProps & string] ? GetProps[keyof TInjectedProps & string] : TInjectedProps[keyof TInjectedProps & string] : GetProps[string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'keyof GetProps & string extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & keyof GetProps & string] extends GetProps[keyof TInjectedProps & keyof GetProps & string] ? GetProps[keyof TInjectedProps & keyof GetProps & string] : TInjectedProps[keyof TInjectedProps & keyof GetProps & string] : GetProps[keyof GetProps & string]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[keyof TInjectedProps & Extract>] extends GetProps[keyof TInjectedProps & Extract>] ? GetProps[keyof TInjectedProps & Extract>] : TInjectedProps[keyof TInjectedProps & Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'Extract> extends keyof TInjectedProps ? TInjectedProps[Extract>] extends GetProps[Extract>] ? GetProps[Extract>] : TInjectedProps[Extract>] : GetProps[Extract>]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. +!!! error TS2344: Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps[P] ? GetProps[P] : TInjectedProps[P] : GetProps[P]' is not assignable to type 'TInjectedProps[P] extends GetProps[P] ? GetProps[P] : never'. + >; + + declare const connect: { + ( + mapStateToProps: null | undefined, + mapDispatchToProps: TDispatchProps + ): InferableComponentEnhancerWithProps< + ResolveThunks, + TOwnProps + >; + }; + + type InferThunkActionCreatorType< + TActionCreator extends (...args: any[]) => any + > = TActionCreator extends ( + ...args: infer TParams + ) => (...args: any[]) => infer TReturn + ? (...args: TParams) => TReturn + : TActionCreator; + + type HandleThunkActionCreator = TActionCreator extends ( + ...args: any[] + ) => any + ? InferThunkActionCreatorType + : TActionCreator; + + type ResolveThunks = TDispatchProps extends { + [key: string]: any; + } + ? { [C in keyof TDispatchProps]: HandleThunkActionCreator } + : TDispatchProps; + + interface Dispatch { + (action: T): T; + } + interface Action { + type: T; + } + interface AnyAction extends Action { + [extraProps: string]: any; + } + + const simpleAction = (payload: boolean) => ({ + type: "SIMPLE_ACTION", + payload + }); + const thunkAction = (param1: number, param2: string) => async ( + dispatch: Dispatch, + { foo }: OwnProps + ) => { + return foo; + }; + interface OwnProps { + foo: string; + } + interface TestComponentProps extends OwnProps { + simpleAction: typeof simpleAction; + thunkAction(param1: number, param2: string): Promise; + } + class TestComponent extends Component {} + const mapDispatchToProps = { simpleAction, thunkAction }; + + type Q = HandleThunkActionCreator; + + const Test1 = connect( + null, + mapDispatchToProps + )(TestComponent); + \ No newline at end of file diff --git a/tests/baselines/reference/recursiveBaseCheck3.errors.txt b/tests/baselines/reference/recursiveBaseCheck3.errors.txt index 2c08a3c44d2..888a3ebd66c 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck3.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/recursiveBaseCheck3.ts(1,7): error TS2506: 'A' is referenced directly or indirectly in its own base expression. tests/cases/compiler/recursiveBaseCheck3.ts(1,20): error TS2449: Class 'C' used before its declaration. tests/cases/compiler/recursiveBaseCheck3.ts(2,7): error TS2506: 'C' is referenced directly or indirectly in its own base expression. -tests/cases/compiler/recursiveBaseCheck3.ts(4,9): error TS2339: Property 'blah' does not exist on type 'C<{}>'. +tests/cases/compiler/recursiveBaseCheck3.ts(4,9): error TS2339: Property 'blah' does not exist on type 'C'. ==== tests/cases/compiler/recursiveBaseCheck3.ts (4 errors) ==== @@ -17,4 +17,4 @@ tests/cases/compiler/recursiveBaseCheck3.ts(4,9): error TS2339: Property 'blah' (new C).blah; ~~~~ -!!! error TS2339: Property 'blah' does not exist on type 'C<{}>'. \ No newline at end of file +!!! error TS2339: Property 'blah' does not exist on type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveBaseCheck3.types b/tests/baselines/reference/recursiveBaseCheck3.types index 762276cc1d2..d4820691017 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.types +++ b/tests/baselines/reference/recursiveBaseCheck3.types @@ -9,8 +9,8 @@ class C extends A { } (new C).blah; >(new C).blah : any ->(new C) : C<{}> ->new C : C<{}> +>(new C) : C +>new C : C >C : typeof C >blah : any diff --git a/tests/baselines/reference/recursiveBaseCheck4.errors.txt b/tests/baselines/reference/recursiveBaseCheck4.errors.txt index 5616523d14e..09fee33ced2 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck4.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/recursiveBaseCheck4.ts(1,7): error TS2506: 'M' is referenced directly or indirectly in its own base expression. -tests/cases/compiler/recursiveBaseCheck4.ts(2,9): error TS2339: Property 'blah' does not exist on type 'M<{}>'. +tests/cases/compiler/recursiveBaseCheck4.ts(2,9): error TS2339: Property 'blah' does not exist on type 'M'. ==== tests/cases/compiler/recursiveBaseCheck4.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/recursiveBaseCheck4.ts(2,9): error TS2339: Property 'blah' !!! error TS2506: 'M' is referenced directly or indirectly in its own base expression. (new M).blah; ~~~~ -!!! error TS2339: Property 'blah' does not exist on type 'M<{}>'. \ No newline at end of file +!!! error TS2339: Property 'blah' does not exist on type 'M'. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveBaseCheck4.types b/tests/baselines/reference/recursiveBaseCheck4.types index 4a826c0222b..bd5e3d6c962 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.types +++ b/tests/baselines/reference/recursiveBaseCheck4.types @@ -5,8 +5,8 @@ class M extends M { } (new M).blah; >(new M).blah : any ->(new M) : M<{}> ->new M : M<{}> +>(new M) : M +>new M : M >M : typeof M >blah : any diff --git a/tests/baselines/reference/recursiveBaseCheck5.errors.txt b/tests/baselines/reference/recursiveBaseCheck5.errors.txt index 91a6d5c8456..89c857b741f 100644 --- a/tests/baselines/reference/recursiveBaseCheck5.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck5.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/recursiveBaseCheck5.ts(1,11): error TS2310: Type 'I1' recursively references itself as a base type. -tests/cases/compiler/recursiveBaseCheck5.ts(4,9): error TS2339: Property 'blah' does not exist on type 'X<{}, {}>'. +tests/cases/compiler/recursiveBaseCheck5.ts(4,9): error TS2339: Property 'blah' does not exist on type 'X'. ==== tests/cases/compiler/recursiveBaseCheck5.ts (2 errors) ==== @@ -10,4 +10,4 @@ tests/cases/compiler/recursiveBaseCheck5.ts(4,9): error TS2339: Property 'blah' class X implements I2 { } (new X).blah; ~~~~ -!!! error TS2339: Property 'blah' does not exist on type 'X<{}, {}>'. \ No newline at end of file +!!! error TS2339: Property 'blah' does not exist on type 'X'. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveBaseCheck5.types b/tests/baselines/reference/recursiveBaseCheck5.types index 0f0a96f3c85..fad0205a533 100644 --- a/tests/baselines/reference/recursiveBaseCheck5.types +++ b/tests/baselines/reference/recursiveBaseCheck5.types @@ -6,8 +6,8 @@ class X implements I2 { } (new X).blah; >(new X).blah : any ->(new X) : X<{}, {}> ->new X : X<{}, {}> +>(new X) : X +>new X : X >X : typeof X >blah : any diff --git a/tests/baselines/reference/recursiveBaseCheck6.errors.txt b/tests/baselines/reference/recursiveBaseCheck6.errors.txt index 6d453da425f..3482167d15e 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck6.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/recursiveBaseCheck6.ts(1,7): error TS2506: 'S18' is referenced directly or indirectly in its own base expression. -tests/cases/compiler/recursiveBaseCheck6.ts(2,13): error TS2339: Property 'blah' does not exist on type 'S18<{}>'. +tests/cases/compiler/recursiveBaseCheck6.ts(2,13): error TS2339: Property 'blah' does not exist on type 'S18'. ==== tests/cases/compiler/recursiveBaseCheck6.ts (2 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/recursiveBaseCheck6.ts(2,13): error TS2339: Property 'blah' !!! error TS2506: 'S18' is referenced directly or indirectly in its own base expression. (new S18()).blah; ~~~~ -!!! error TS2339: Property 'blah' does not exist on type 'S18<{}>'. \ No newline at end of file +!!! error TS2339: Property 'blah' does not exist on type 'S18'. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveBaseCheck6.types b/tests/baselines/reference/recursiveBaseCheck6.types index ba22aac3d60..7df0f83c989 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.types +++ b/tests/baselines/reference/recursiveBaseCheck6.types @@ -6,8 +6,8 @@ class S18 extends S18<{ S19: A; }>{ } (new S18()).blah; >(new S18()).blah : any ->(new S18()) : S18<{}> ->new S18() : S18<{}> +>(new S18()) : S18 +>new S18() : S18 >S18 : typeof S18 >blah : any diff --git a/tests/baselines/reference/restTupleElements1.errors.txt b/tests/baselines/reference/restTupleElements1.errors.txt index 9782be35566..316ecc209aa 100644 --- a/tests/baselines/reference/restTupleElements1.errors.txt +++ b/tests/baselines/reference/restTupleElements1.errors.txt @@ -22,8 +22,8 @@ tests/cases/conformance/types/tuple/restTupleElements1.ts(34,31): error TS2344: tests/cases/conformance/types/tuple/restTupleElements1.ts(35,31): error TS2344: Type '[number, number, number, string]' does not satisfy the constraint '[number, ...number[]]'. Property '3' is incompatible with rest element type. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/restTupleElements1.ts(59,4): error TS2345: Argument of type '[]' is not assignable to parameter of type '[{}, ...{}[]]'. - Property '0' is missing in type '[]' but required in type '[{}, ...{}[]]'. +tests/cases/conformance/types/tuple/restTupleElements1.ts(59,4): error TS2345: Argument of type '[]' is not assignable to parameter of type '[unknown, ...unknown[]]'. + Property '0' is missing in type '[]' but required in type '[unknown, ...unknown[]]'. ==== tests/cases/conformance/types/tuple/restTupleElements1.ts (14 errors) ==== @@ -124,8 +124,8 @@ tests/cases/conformance/types/tuple/restTupleElements1.ts(59,4): error TS2345: A f0([]); // Error ~~ -!!! error TS2345: Argument of type '[]' is not assignable to parameter of type '[{}, ...{}[]]'. -!!! error TS2345: Property '0' is missing in type '[]' but required in type '[{}, ...{}[]]'. +!!! error TS2345: Argument of type '[]' is not assignable to parameter of type '[unknown, ...unknown[]]'. +!!! error TS2345: Property '0' is missing in type '[]' but required in type '[unknown, ...unknown[]]'. f0([1]); f0([1, 2, 3]); f0([1, "hello", true]); diff --git a/tests/baselines/reference/returnTypeParameterWithModules.types b/tests/baselines/reference/returnTypeParameterWithModules.types index 0f62a2ea46c..d9546bda856 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.types +++ b/tests/baselines/reference/returnTypeParameterWithModules.types @@ -39,7 +39,7 @@ module M2 { >compose : () => void A.reduce(arguments, compose2); ->A.reduce(arguments, compose2) : {}[] +>A.reduce(arguments, compose2) : unknown[] >A.reduce : (ar: any, f: any, e?: any) => A[] >A : typeof A >reduce : (ar: any, f: any, e?: any) => A[] diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.types b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.types index b08dc02df77..d538da4402c 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.types +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.types @@ -177,29 +177,29 @@ someGenerics6 `${ n => n }${ n => n}${ n => n}`; >someGenerics6 `${ n => n }${ n => n}${ n => n}` : void >someGenerics6 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) => void >`${ n => n }${ n => n}${ n => n}` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics6 `${ n => n }${ n => n}${ n => n}`; >someGenerics6 `${ n => n }${ n => n}${ n => n}` : void >someGenerics6 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) => void >`${ n => n }${ n => n}${ n => n}` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`; >someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }` : void @@ -230,29 +230,29 @@ someGenerics7 `${ n => n }${ n => n }${ n => n }`; >someGenerics7 `${ n => n }${ n => n }${ n => n }` : void >someGenerics7 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void >`${ n => n }${ n => n }${ n => n }` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics7 `${ n => n }${ n => n }${ n => n }`; >someGenerics7 `${ n => n }${ n => n }${ n => n }` : void >someGenerics7 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void >`${ n => n }${ n => n }${ n => n }` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`; >someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}` : void diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.types b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.types index 88657a6ac0f..0cb787ec4c1 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.types +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.types @@ -177,29 +177,29 @@ someGenerics6 `${ n => n }${ n => n}${ n => n}`; >someGenerics6 `${ n => n }${ n => n}${ n => n}` : void >someGenerics6 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) => void >`${ n => n }${ n => n}${ n => n}` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics6 `${ n => n }${ n => n}${ n => n}`; >someGenerics6 `${ n => n }${ n => n}${ n => n}` : void >someGenerics6 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) => void >`${ n => n }${ n => n}${ n => n}` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }`; >someGenerics6 `${ (n: number) => n }${ (n: number) => n }${ (n: number) => n }` : void @@ -230,29 +230,29 @@ someGenerics7 `${ n => n }${ n => n }${ n => n }`; >someGenerics7 `${ n => n }${ n => n }${ n => n }` : void >someGenerics7 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void >`${ n => n }${ n => n }${ n => n }` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics7 `${ n => n }${ n => n }${ n => n }`; >someGenerics7 `${ n => n }${ n => n }${ n => n }` : void >someGenerics7 : (strs: TemplateStringsArray, a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void >`${ n => n }${ n => n }${ n => n }` : string ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}`; >someGenerics7 `${(n: number) => n}${ (n: string) => n}${ (n: number) => n}` : void diff --git a/tests/baselines/reference/tsxElementResolution12.errors.txt b/tests/baselines/reference/tsxElementResolution12.errors.txt index 8e9b150d69f..4bd82a9b21c 100644 --- a/tests/baselines/reference/tsxElementResolution12.errors.txt +++ b/tests/baselines/reference/tsxElementResolution12.errors.txt @@ -1,12 +1,10 @@ tests/cases/conformance/jsx/file.tsx(23,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. -tests/cases/conformance/jsx/file.tsx(23,2): error TS2322: Type '{ x: number; }' is not assignable to type '{}'. - Property 'x' does not exist on type '{}'. tests/cases/conformance/jsx/file.tsx(25,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. tests/cases/conformance/jsx/file.tsx(26,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. tests/cases/conformance/jsx/file.tsx(33,7): error TS2322: Type 'string' is not assignable to type 'number'. -==== tests/cases/conformance/jsx/file.tsx (5 errors) ==== +==== tests/cases/conformance/jsx/file.tsx (4 errors) ==== declare module JSX { interface Element { } interface ElementAttributesProperty { pr: any; } @@ -32,9 +30,6 @@ tests/cases/conformance/jsx/file.tsx(33,7): error TS2322: Type 'string' is not a ; // Error ~~~~~~~~~~~~~~~ !!! error TS2607: JSX element class does not support attributes because it does not have a 'pr' property. - ~~~~ -!!! error TS2322: Type '{ x: number; }' is not assignable to type '{}'. -!!! error TS2322: Property 'x' does not exist on type '{}'. var attributes: any; ; // Error ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt index 742957b66ad..7a6a6fbdcba 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments2.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/jsx/file.tsx(8,43): error TS2322: Type '10' is not assignable to type 'string'. -tests/cases/conformance/jsx/file.tsx(13,15): error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: {}; "ignore-prop": string; }'. - Type 'T' is not assignable to type '{ prop: {}; "ignore-prop": string; }'. +tests/cases/conformance/jsx/file.tsx(13,15): error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: unknown; "ignore-prop": string; }'. + Type 'T' is not assignable to type '{ prop: unknown; "ignore-prop": string; }'. tests/cases/conformance/jsx/file.tsx(20,19): error TS2322: Type '(a: number, b: string) => void' is not assignable to type '(arg: number) => void'. tests/cases/conformance/jsx/file.tsx(31,52): error TS2322: Type '(val: string) => void' is not assignable to type '(selectedVal: number) => void'. Types of parameters 'val' and 'selectedVal' are incompatible. @@ -25,8 +25,8 @@ tests/cases/conformance/jsx/file.tsx(31,52): error TS2322: Type '(val: string) = function Baz(arg: T) { let a0 = ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: {}; "ignore-prop": string; }'. -!!! error TS2322: Type 'T' is not assignable to type '{ prop: {}; "ignore-prop": string; }'. +!!! error TS2322: Type 'T' is not assignable to type 'IntrinsicAttributes & { prop: unknown; "ignore-prop": string; }'. +!!! error TS2322: Type 'T' is not assignable to type '{ prop: unknown; "ignore-prop": string; }'. } declare function Link(l: {func: (arg: U)=>void}): JSX.Element; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt index f8b3d08d3f4..38d4435a46d 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentsWithTypeArguments4.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/jsx/file.tsx(9,15): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: {}; a: number; }'. -tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: {}; a: {}; }'. - Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: {}; a: {}; }'. +tests/cases/conformance/jsx/file.tsx(9,15): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. +tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. + Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'. ==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== @@ -14,11 +14,11 @@ tests/cases/conformance/jsx/file.tsx(10,15): error TS2322: Type 'T & { ignore-pr function Baz(arg1: T, arg2: U) { let a0 = ~~~~~~~~~~~~~~~~~ -!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: {}; a: number; }'. +!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: unknown; a: number; }'. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:49: 'b' is declared here. let a2 = // missing a ~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: {}; a: {}; }'. -!!! error TS2322: Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: {}; a: {}; }'. +!!! error TS2322: Type 'T & { ignore-prop: true; }' is not assignable to type 'IntrinsicAttributes & { b: unknown; a: unknown; }'. +!!! error TS2322: Property 'a' is missing in type '{ b: number; } & { ignore-prop: true; }' but required in type '{ b: unknown; a: unknown; }'. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:5:55: 'a' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/tsxTypeErrors.errors.txt b/tests/baselines/reference/tsxTypeErrors.errors.txt deleted file mode 100644 index 1539c7c2bb1..00000000000 --- a/tests/baselines/reference/tsxTypeErrors.errors.txt +++ /dev/null @@ -1,46 +0,0 @@ -tests/cases/conformance/jsx/tsxTypeErrors.tsx(25,11): error TS2322: Type '{ reqd: boolean; }' is not assignable to type '{}'. - Property 'reqd' does not exist on type '{}'. -tests/cases/conformance/jsx/tsxTypeErrors.tsx(31,11): error TS2322: Type '{ pt: { x: number; y: string; }; }' is not assignable to type '{}'. - Property 'pt' does not exist on type '{}'. - - -==== tests/cases/conformance/jsx/tsxTypeErrors.tsx (2 errors) ==== - // A built-in element (OK) - var a1 =

; - - // A built-in element with a mistyped property (error) - var a2 = - - // A built-in element with a badly-typed attribute value (error) - var thing = { oops: 100 }; - var a3 =
- - // Mistyped html name (error) - var e1 = - - // A custom type - class MyClass { - props: { - pt?: { x: number; y: number; }; - name?: string; - reqd: boolean; - } - } - - // Let's use it - // TODO: Error on missing 'reqd' - var b1 = ; - ~~~~~~~ -!!! error TS2322: Type '{ reqd: boolean; }' is not assignable to type '{}'. -!!! error TS2322: Property 'reqd' does not exist on type '{}'. - - // Mistyped attribute member - // sample.tsx(23,22): error TS2322: Type '{ x: number; y: string; }' is not assignable to type '{ x: number; y: number; }'. - // Types of property 'y' are incompatible. - // Type 'string' is not assignable to type 'number'. - var b2 = ; - ~~~~~~~ -!!! error TS2322: Type '{ pt: { x: number; y: string; }; }' is not assignable to type '{}'. -!!! error TS2322: Property 'pt' does not exist on type '{}'. - - \ No newline at end of file diff --git a/tests/baselines/reference/tsxTypeErrors.types b/tests/baselines/reference/tsxTypeErrors.types index 91740cf88de..e90b0fdf8c3 100644 --- a/tests/baselines/reference/tsxTypeErrors.types +++ b/tests/baselines/reference/tsxTypeErrors.types @@ -1,15 +1,15 @@ === tests/cases/conformance/jsx/tsxTypeErrors.tsx === // A built-in element (OK) var a1 =
; ->a1 : any ->
: any +>a1 : error +>
: error >div : any >id : string // A built-in element with a mistyped property (error) var a2 = ->a2 : any -> : any +>a2 : error +> : error >img : any >srce : string @@ -21,16 +21,16 @@ var thing = { oops: 100 }; >100 : 100 var a3 =
->a3 : any ->
: any +>a3 : error +>
: error >div : any >id : { oops: number; } >thing : { oops: number; } // Mistyped html name (error) var e1 = ->e1 : any -> : any +>e1 : error +> : error >imag : any >src : string @@ -57,8 +57,8 @@ class MyClass { // Let's use it // TODO: Error on missing 'reqd' var b1 = ; ->b1 : any -> : any +>b1 : error +> : error >MyClass : typeof MyClass >reqd : boolean >true : true @@ -68,8 +68,8 @@ var b1 = ; // Types of property 'y' are incompatible. // Type 'string' is not assignable to type 'number'. var b2 = ; ->b2 : any -> : any +>b2 : error +> : error >MyClass : typeof MyClass >pt : { x: number; y: string; } >{x: 4, y: 'oops'} : { x: number; y: string; } diff --git a/tests/baselines/reference/tupleTypeInference2.types b/tests/baselines/reference/tupleTypeInference2.types index 3074f535742..9983ba993ef 100644 --- a/tests/baselines/reference/tupleTypeInference2.types +++ b/tests/baselines/reference/tupleTypeInference2.types @@ -34,7 +34,7 @@ declare function g(f: B): U; >f : B g([[]] as [void[]]); // U: {} ->g([[]] as [void[]]) : {} +>g([[]] as [void[]]) : unknown >g : (f: B) => U >[[]] as [void[]] : [void[]] >[[]] : [never[]] @@ -48,7 +48,7 @@ declare function h(f: C): U; >f : C h([[]] as [void[]]); // U: {} ->h([[]] as [void[]]) : {} +>h([[]] as [void[]]) : unknown >h : (f: C) => U >[[]] as [void[]] : [void[]] >[[]] : [never[]] diff --git a/tests/baselines/reference/typeArgumentInference.types b/tests/baselines/reference/typeArgumentInference.types index 8e92373f745..866e413403c 100644 --- a/tests/baselines/reference/typeArgumentInference.types +++ b/tests/baselines/reference/typeArgumentInference.types @@ -210,15 +210,15 @@ function someGenerics6(a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) { } someGenerics6(n => n, n => n, n => n); >someGenerics6(n => n, n => n, n => n) : void >someGenerics6 : (a: (a: A) => A, b: (b: A) => A, c: (c: A) => A) => void ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics6(n => n, n => n, n => n); >someGenerics6(n => n, n => n, n => n) : void @@ -259,15 +259,15 @@ function someGenerics7(a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) someGenerics7(n => n, n => n, n => n); >someGenerics7(n => n, n => n, n => n) : void >someGenerics7 : (a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics7(n => n, n => n, n => n); >someGenerics7(n => n, n => n, n => n) : void diff --git a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.types b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.types index af5f3f0c445..00d32e52dec 100644 --- a/tests/baselines/reference/typeArgumentInferenceConstructSignatures.types +++ b/tests/baselines/reference/typeArgumentInferenceConstructSignatures.types @@ -259,15 +259,15 @@ var someGenerics6: someGenerics6; new someGenerics6(n => n, n => n, n => n); >new someGenerics6(n => n, n => n, n => n) : any >someGenerics6 : someGenerics6 ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown new someGenerics6(n => n, n => n, n => n); >new someGenerics6(n => n, n => n, n => n) : any @@ -324,15 +324,15 @@ var someGenerics7: someGenerics7; new someGenerics7(n => n, n => n, n => n); >new someGenerics7(n => n, n => n, n => n) : any >someGenerics7 : someGenerics7 ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown new someGenerics7(n => n, n => n, n => n); >new someGenerics7(n => n, n => n, n => n) : any diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.errors.txt b/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.errors.txt index 6a691c2045a..33e2f2e38c1 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.errors.txt +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression2.ts(6,5): error TS2345: Argument of type 'typeof (Anonymous class)' is not assignable to parameter of type 'typeof (Anonymous class)'. - Property 'prop' is missing in type '(Anonymous class)' but required in type 'foo<{}>.(Anonymous class)'. + Property 'prop' is missing in type '(Anonymous class)' but required in type 'foo.(Anonymous class)'. ==== tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression2.ts (1 errors) ==== @@ -11,5 +11,5 @@ tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpre foo(class { static prop = "hello" }).length; ~~~~~ !!! error TS2345: Argument of type 'typeof (Anonymous class)' is not assignable to parameter of type 'typeof (Anonymous class)'. -!!! error TS2345: Property 'prop' is missing in type '(Anonymous class)' but required in type 'foo<{}>.(Anonymous class)'. +!!! error TS2345: Property 'prop' is missing in type '(Anonymous class)' but required in type 'foo.(Anonymous class)'. !!! related TS2728 tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression2.ts:1:29: 'prop' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.types b/tests/baselines/reference/typeArgumentInferenceWithConstraints.types index d6d745e7bc4..e5d499398ff 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.types +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.types @@ -300,15 +300,15 @@ function someGenerics7(a: (a: A) => A, b: (b: B) => B, c someGenerics7(n => n, n => n, n => n); // Valid, types of n are respectively >someGenerics7(n => n, n => n, n => n) : void >someGenerics7 : (a: (a: A) => A, b: (b: B) => B, c: (c: C) => C) => void ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown >n => n : (n: string) => string >n : string >n : string ->n => n : (n: {}) => {} ->n : {} ->n : {} +>n => n : (n: unknown) => unknown +>n : unknown +>n : unknown someGenerics7(n => n, n => n, n => n); >someGenerics7(n => n, n => n, n => n) : void diff --git a/tests/baselines/reference/typeInferenceFixEarly.types b/tests/baselines/reference/typeInferenceFixEarly.types index fa23dc7f133..062560586c6 100644 --- a/tests/baselines/reference/typeInferenceFixEarly.types +++ b/tests/baselines/reference/typeInferenceFixEarly.types @@ -5,9 +5,9 @@ declare function f(p: (t: T) => T): T; >t : T f(n => 3); ->f(n => 3) : {} +>f(n => 3) : unknown >f : (p: (t: T) => T) => T ->n => 3 : (n: {}) => number ->n : {} +>n => 3 : (n: unknown) => number +>n : unknown >3 : 3 diff --git a/tests/baselines/reference/typeOfThisInStaticMembers.types b/tests/baselines/reference/typeOfThisInStaticMembers.types index dedceb364dd..8ca2201ae85 100644 --- a/tests/baselines/reference/typeOfThisInStaticMembers.types +++ b/tests/baselines/reference/typeOfThisInStaticMembers.types @@ -99,8 +99,8 @@ var r6 = t2.bar(); >bar : () => typeof C2 var r7 = new t2(''); ->r7 : C2<{}> ->new t2('') : C2<{}> +>r7 : C2 +>new t2('') : C2 >t2 : typeof C2 >'' : "" diff --git a/tests/baselines/reference/underscoreTest1.errors.txt b/tests/baselines/reference/underscoreTest1.errors.txt index ca8df792231..66fc8961eef 100644 --- a/tests/baselines/reference/underscoreTest1.errors.txt +++ b/tests/baselines/reference/underscoreTest1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/underscoreTest1_underscoreTests.ts(26,7): error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary<{}>'. +tests/cases/compiler/underscoreTest1_underscoreTests.ts(26,7): error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary'. Index signature is missing in type '(string | number | boolean)[]'. @@ -30,7 +30,7 @@ tests/cases/compiler/underscoreTest1_underscoreTests.ts(26,7): error TS2345: Arg _.all([true, 1, null, 'yes'], _.identity); ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary<{}>'. +!!! error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type 'Dictionary'. !!! error TS2345: Index signature is missing in type '(string | number | boolean)[]'. _.any([null, 0, 'yes', false]); diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index c247c40cd1d..5a210c8b214 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -521,7 +521,7 @@ _.compact([0, 1, false, 2, '', 3]); >3 : 3 _.flatten([1, 2, 3, 4]); ->_.flatten([1, 2, 3, 4]) : {}[] +>_.flatten([1, 2, 3, 4]) : unknown[] >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } @@ -532,7 +532,7 @@ _.flatten([1, 2, 3, 4]); >4 : 4 _.flatten([1, [2]]); ->_.flatten([1, [2]]) : {}[] +>_.flatten([1, [2]]) : unknown[] >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } @@ -543,7 +543,7 @@ _.flatten([1, [2]]); // typescript doesn't like the elements being different _.flatten([1, [2], [3, [[4]]]]); ->_.flatten([1, [2], [3, [[4]]]]) : {}[] +>_.flatten([1, [2], [3, [[4]]]]) : unknown[] >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } @@ -558,7 +558,7 @@ _.flatten([1, [2], [3, [[4]]]]); >4 : 4 _.flatten([1, [2], [3, [[4]]]], true); ->_.flatten([1, [2], [3, [[4]]]], true) : {}[] +>_.flatten([1, [2], [3, [[4]]]], true) : unknown[] >_.flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } >_ : Underscore.Static >flatten : { (list: T[][]): T[]; (array: any[], shallow?: boolean): T[]; } diff --git a/tests/baselines/reference/unknownType1.errors.txt b/tests/baselines/reference/unknownType1.errors.txt index 57fb6114069..93e2a8660f6 100644 --- a/tests/baselines/reference/unknownType1.errors.txt +++ b/tests/baselines/reference/unknownType1.errors.txt @@ -18,6 +18,8 @@ tests/cases/conformance/types/unknown/unknownType1.ts(114,9): error TS2322: Type Type 'unknown' is not assignable to type '{}'. tests/cases/conformance/types/unknown/unknownType1.ts(120,9): error TS2322: Type 'T' is not assignable to type 'object'. Type 'unknown' is not assignable to type 'object'. +tests/cases/conformance/types/unknown/unknownType1.ts(128,5): error TS2322: Type 'number[]' is not assignable to type '{ [x: string]: unknown; }'. + Index signature is missing in type 'number[]'. tests/cases/conformance/types/unknown/unknownType1.ts(129,5): error TS2322: Type '123' is not assignable to type '{ [x: string]: unknown; }'. tests/cases/conformance/types/unknown/unknownType1.ts(149,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/types/unknown/unknownType1.ts(155,14): error TS2700: Rest types may only be created from object types. @@ -28,7 +30,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(180,5): error TS2322: Type Type 'unknown' is not assignable to type '{}'. -==== tests/cases/conformance/types/unknown/unknownType1.ts (24 errors) ==== +==== tests/cases/conformance/types/unknown/unknownType1.ts (25 errors) ==== // In an intersection everything absorbs unknown type T00 = unknown & null; // null @@ -189,12 +191,15 @@ tests/cases/conformance/types/unknown/unknownType1.ts(180,5): error TS2322: Type !!! error TS2322: Type 'unknown' is not assignable to type 'object'. } - // Anything but primitive assignable to { [x: string]: unknown } + // Anything fresh but primitive assignable to { [x: string]: unknown } function f24(x: { [x: string]: unknown }) { x = {}; x = { a: 5 }; - x = [1, 2, 3]; + x = [1, 2, 3]; // Error + ~ +!!! error TS2322: Type 'number[]' is not assignable to type '{ [x: string]: unknown; }'. +!!! error TS2322: Index signature is missing in type 'number[]'. x = 123; // Error ~ !!! error TS2322: Type '123' is not assignable to type '{ [x: string]: unknown; }'. diff --git a/tests/baselines/reference/unknownType1.js b/tests/baselines/reference/unknownType1.js index 9dd1568861f..b7e40954359 100644 --- a/tests/baselines/reference/unknownType1.js +++ b/tests/baselines/reference/unknownType1.js @@ -121,12 +121,12 @@ function f23(x: T) { let y: object = x; // Error } -// Anything but primitive assignable to { [x: string]: unknown } +// Anything fresh but primitive assignable to { [x: string]: unknown } function f24(x: { [x: string]: unknown }) { x = {}; x = { a: 5 }; - x = [1, 2, 3]; + x = [1, 2, 3]; // Error x = 123; // Error } @@ -262,11 +262,11 @@ function f22(x) { function f23(x) { var y = x; // Error } -// Anything but primitive assignable to { [x: string]: unknown } +// Anything fresh but primitive assignable to { [x: string]: unknown } function f24(x) { x = {}; x = { a: 5 }; - x = [1, 2, 3]; + x = [1, 2, 3]; // Error x = 123; // Error } // Locals of type unknown always considered initialized diff --git a/tests/baselines/reference/unknownType1.symbols b/tests/baselines/reference/unknownType1.symbols index a91664fe029..d4bdffc0163 100644 --- a/tests/baselines/reference/unknownType1.symbols +++ b/tests/baselines/reference/unknownType1.symbols @@ -314,7 +314,7 @@ function f23(x: T) { >x : Symbol(x, Decl(unknownType1.ts, 118, 32)) } -// Anything but primitive assignable to { [x: string]: unknown } +// Anything fresh but primitive assignable to { [x: string]: unknown } function f24(x: { [x: string]: unknown }) { >f24 : Symbol(f24, Decl(unknownType1.ts, 120, 1)) @@ -328,7 +328,7 @@ function f24(x: { [x: string]: unknown }) { >x : Symbol(x, Decl(unknownType1.ts, 124, 13)) >a : Symbol(a, Decl(unknownType1.ts, 126, 9)) - x = [1, 2, 3]; + x = [1, 2, 3]; // Error >x : Symbol(x, Decl(unknownType1.ts, 124, 13)) x = 123; // Error diff --git a/tests/baselines/reference/unknownType1.types b/tests/baselines/reference/unknownType1.types index bd3408a914d..a464864d0d1 100644 --- a/tests/baselines/reference/unknownType1.types +++ b/tests/baselines/reference/unknownType1.types @@ -342,7 +342,7 @@ function f23(x: T) { >x : T } -// Anything but primitive assignable to { [x: string]: unknown } +// Anything fresh but primitive assignable to { [x: string]: unknown } function f24(x: { [x: string]: unknown }) { >f24 : (x: { [x: string]: unknown; }) => void @@ -361,7 +361,7 @@ function f24(x: { [x: string]: unknown }) { >a : number >5 : 5 - x = [1, 2, 3]; + x = [1, 2, 3]; // Error >x = [1, 2, 3] : number[] >x : { [x: string]: unknown; } >[1, 2, 3] : number[] diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.types b/tests/baselines/reference/useObjectValuesAndEntries1.types index 2346a56895a..94deebdfd8c 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.types +++ b/tests/baselines/reference/useObjectValuesAndEntries1.types @@ -77,16 +77,16 @@ var values2 = Object.values({ a: true, b: 2 }); // (number|boolean)[] >2 : 2 var entries3 = Object.entries({}); // [string, {}][] ->entries3 : [string, {}][] ->Object.entries({}) : [string, {}][] +>entries3 : [string, unknown][] +>Object.entries({}) : [string, unknown][] >Object.entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor >entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } >{} : {} var values3 = Object.values({}); // {}[] ->values3 : {}[] ->Object.values({}) : {}[] +>values3 : unknown[] +>Object.values({}) : unknown[] >Object.values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } >Object : ObjectConstructor >values : { (o: { [s: string]: T; } | ArrayLike): T[]; (o: {}): any[]; } diff --git a/tests/baselines/reference/usePromiseFinally.types b/tests/baselines/reference/usePromiseFinally.types index 80534c75610..b704e54231c 100644 --- a/tests/baselines/reference/usePromiseFinally.types +++ b/tests/baselines/reference/usePromiseFinally.types @@ -1,15 +1,15 @@ === tests/cases/conformance/es2018/usePromiseFinally.ts === let promise1 = new Promise(function(resolve, reject) {}) ->promise1 : Promise<{}> ->new Promise(function(resolve, reject) {}) .finally(function() {}) : Promise<{}> ->new Promise(function(resolve, reject) {}) .finally : (onfinally?: () => void) => Promise<{}> ->new Promise(function(resolve, reject) {}) : Promise<{}> +>promise1 : Promise +>new Promise(function(resolve, reject) {}) .finally(function() {}) : Promise +>new Promise(function(resolve, reject) {}) .finally : (onfinally?: () => void) => Promise +>new Promise(function(resolve, reject) {}) : Promise >Promise : PromiseConstructor ->function(resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void ->resolve : (value?: {} | PromiseLike<{}>) => void +>function(resolve, reject) {} : (resolve: (value?: unknown) => void, reject: (reason?: any) => void) => void +>resolve : (value?: unknown) => void >reject : (reason?: any) => void .finally(function() {}); ->finally : (onfinally?: () => void) => Promise<{}> +>finally : (onfinally?: () => void) => Promise >function() {} : () => void diff --git a/tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts b/tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts new file mode 100644 index 00000000000..82520579dc9 --- /dev/null +++ b/tests/cases/compiler/indexSignatureOfTypeUnknownStillRequiresIndexSignature.ts @@ -0,0 +1,9 @@ +declare function f(x: { [x: string]: T }): T; + +var stooges = [ + { name: "moe", age: 40 }, + { name: "larry", age: 50 }, + { name: "curly", age: 60 } +]; + +f(stooges); // Should throw diff --git a/tests/cases/conformance/types/unknown/unknownType1.ts b/tests/cases/conformance/types/unknown/unknownType1.ts index d1f5ce11261..633b1407f96 100644 --- a/tests/cases/conformance/types/unknown/unknownType1.ts +++ b/tests/cases/conformance/types/unknown/unknownType1.ts @@ -122,12 +122,12 @@ function f23(x: T) { let y: object = x; // Error } -// Anything but primitive assignable to { [x: string]: unknown } +// Anything fresh but primitive assignable to { [x: string]: unknown } function f24(x: { [x: string]: unknown }) { x = {}; x = { a: 5 }; - x = [1, 2, 3]; + x = [1, 2, 3]; // Error x = 123; // Error } diff --git a/tests/cases/fourslash/automaticConstructorToggling.ts b/tests/cases/fourslash/automaticConstructorToggling.ts index 62015a09eb9..6bf4f3bab57 100644 --- a/tests/cases/fourslash/automaticConstructorToggling.ts +++ b/tests/cases/fourslash/automaticConstructorToggling.ts @@ -28,7 +28,7 @@ edit.deleteAtCaret('constructor(val: T) { }'.length); verify.quickInfos({ Asig: "constructor A(): A", Bsig: "constructor B(val: string): B", - Csig: "constructor C<{}>(): C<{}>", // Cannot resolve signature + Csig: "constructor C(): C", // Cannot resolve signature Dsig: "constructor D(val: string): D" // Cannot resolve signature }); @@ -37,6 +37,6 @@ edit.deleteAtCaret("val: T".length); verify.quickInfos({ Asig: "constructor A(): A", Bsig: "constructor B(val: string): B", - Csig: "constructor C<{}>(): C<{}>", // Cannot resolve signature + Csig: "constructor C(): C", // Cannot resolve signature Dsig: "constructor D(): D" }); diff --git a/tests/cases/fourslash/constructorQuickInfo.ts b/tests/cases/fourslash/constructorQuickInfo.ts index 489519641a4..efb49eb58c4 100644 --- a/tests/cases/fourslash/constructorQuickInfo.ts +++ b/tests/cases/fourslash/constructorQuickInfo.ts @@ -8,6 +8,6 @@ verify.quickInfos({ 1: "var x1: SS", - 2: "var x2: SS<{}>", - 3: "var x3: SS<{}>" + 2: "var x2: SS", + 3: "var x3: SS" }); diff --git a/tests/cases/fourslash/genericCombinators2.ts b/tests/cases/fourslash/genericCombinators2.ts index aedadfa301e..bff7ec4ffe9 100644 --- a/tests/cases/fourslash/genericCombinators2.ts +++ b/tests/cases/fourslash/genericCombinators2.ts @@ -75,8 +75,8 @@ verify.quickInfos({ 10: "var r1b: Collection", 11: "var r2a: Collection, number>", 12: "var r2b: Collection, number>", - 13: "var r3a: Collection", - 14: "var r3b: Collection", + 13: "var r3a: Collection", + 14: "var r3b: Collection", 15: "var r4a: Collection", 17: "var r5a: Collection", 18: "var r5b: Collection", diff --git a/tests/cases/fourslash/genericDerivedTypeAcrossModuleBoundary1.ts b/tests/cases/fourslash/genericDerivedTypeAcrossModuleBoundary1.ts index d81aa3b9b87..d31883f434e 100644 --- a/tests/cases/fourslash/genericDerivedTypeAcrossModuleBoundary1.ts +++ b/tests/cases/fourslash/genericDerivedTypeAcrossModuleBoundary1.ts @@ -18,5 +18,5 @@ verify.quickInfos({ 1: "var n2: N.D2", - 2: "var n3: N.D2<{}>" + 2: "var n3: N.D2" }); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp1.ts b/tests/cases/fourslash/genericFunctionSignatureHelp1.ts index 7409fa249dd..818dea3ad55 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp1.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp1.ts @@ -3,4 +3,4 @@ ////function f(a: T): T { return null; } ////f(/**/ -verify.signatureHelp({ marker: "", text: "f(a: {}): {}" }); +verify.signatureHelp({ marker: "", text: "f(a: unknown): unknown" }); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp2.ts b/tests/cases/fourslash/genericFunctionSignatureHelp2.ts index a1999b10128..d7101267274 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp2.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp2.ts @@ -3,4 +3,4 @@ ////var f = (a: T) => a; ////f(/**/ -verify.signatureHelp({ marker: "", text: "f(a: {}): {}" }); +verify.signatureHelp({ marker: "", text: "f(a: unknown): unknown" }); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp3.ts b/tests/cases/fourslash/genericFunctionSignatureHelp3.ts index d2180219c2a..9980854385c 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp3.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp3.ts @@ -17,15 +17,15 @@ ////foo7(1, (/*7*/ // signature help shows y as T verify.signatureHelp( - { marker: "1", text: "foo1(x: number, callback: (y1: {}) => number): void" }, - { marker: "2", text: "foo2(x: number, callback: (y2: {}) => number): void" }, - { marker: "3", text: "callback(y3: {}): number" }, + { marker: "1", text: "foo1(x: number, callback: (y1: unknown) => number): void" }, + { marker: "2", text: "foo2(x: number, callback: (y2: unknown) => number): void" }, + { marker: "3", text: "callback(y3: unknown): number" }, { marker: "4", text: "foo4(x: number, callback: (y4: string) => number): void" }, { marker: "5", text: "callback(y5: string): number" }, ); goTo.marker('6'); -verify.signatureHelp({ text: "foo6(x: number, callback: (y6: {}) => number): void" }); +verify.signatureHelp({ text: "foo6(x: number, callback: (y6: unknown) => number): void" }); edit.insert('string>(null,null);'); // need to make this line parse so we can get reasonable LS answers to later tests -verify.signatureHelp({ marker: "7", text: "foo7(x: number, callback: (y7: {}) => number): void" }); +verify.signatureHelp({ marker: "7", text: "foo7(x: number, callback: (y7: unknown) => number): void" }); diff --git a/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts b/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts index eeb27744917..0190db800f6 100644 --- a/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts +++ b/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts @@ -24,15 +24,15 @@ ////foo7(1, (/*7*/ // signature help shows y as T verify.signatureHelp( - { marker: "1", text: "foo1(x: number, callback: (y1: {}) => number): void" }, - { marker: "2", text: "foo2(x: number, callback: (y2: {}) => number): void" }, - { marker: "3", text: "callback(y3: {}): number" }, + { marker: "1", text: "foo1(x: number, callback: (y1: unknown) => number): void" }, + { marker: "2", text: "foo2(x: number, callback: (y2: unknown) => number): void" }, + { marker: "3", text: "callback(y3: unknown): number" }, { marker: "4", text: "foo4(x: number, callback: (y4: string) => number): void" }, { marker: "5", text: "callback(y5: string): number" }, ); goTo.marker('6'); -verify.signatureHelp({ text: "foo6(x: number, callback: (y6: {}) => number): void" }); +verify.signatureHelp({ text: "foo6(x: number, callback: (y6: unknown) => number): void" }); edit.insert('string>(null,null);'); // need to make this line parse so we can get reasonable LS answers to later tests -verify.signatureHelp({ marker: "7", text: "foo7(x: number, callback: (y7: {}) => number): void" }) +verify.signatureHelp({ marker: "7", text: "foo7(x: number, callback: (y7: unknown) => number): void" }) diff --git a/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx b/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx index 71859594cea..d8d7b02a01b 100644 --- a/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx +++ b/tests/cases/fourslash/jsxWithTypeParametershasInstantiatedSignatureHelp.tsx @@ -14,6 +14,6 @@ //// (/>); goTo.marker("1"); -verify.signatureHelp({ text: "SFC(_props: Record): string" }); +verify.signatureHelp({ text: "SFC(_props: Record): string" }); goTo.marker("2"); verify.signatureHelp({ text: "SFC(_props: Record): string" }); diff --git a/tests/cases/fourslash/quickInfo_errorSignatureFillsInTypeParameter.ts b/tests/cases/fourslash/quickInfo_errorSignatureFillsInTypeParameter.ts index 72a81a400f3..540fba58468 100644 --- a/tests/cases/fourslash/quickInfo_errorSignatureFillsInTypeParameter.ts +++ b/tests/cases/fourslash/quickInfo_errorSignatureFillsInTypeParameter.ts @@ -3,4 +3,4 @@ ////declare function f(x: number): T; ////const x/**/ = f(); -verify.quickInfoAt("", "const x: {}"); +verify.quickInfoAt("", "const x: unknown"); diff --git a/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts b/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts index 489519641a4..efb49eb58c4 100644 --- a/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts +++ b/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts @@ -8,6 +8,6 @@ verify.quickInfos({ 1: "var x1: SS", - 2: "var x2: SS<{}>", - 3: "var x3: SS<{}>" + 2: "var x2: SS", + 3: "var x3: SS" }); diff --git a/tests/cases/fourslash/shims/getQuickInfoAtPosition.ts b/tests/cases/fourslash/shims/getQuickInfoAtPosition.ts index 489519641a4..efb49eb58c4 100644 --- a/tests/cases/fourslash/shims/getQuickInfoAtPosition.ts +++ b/tests/cases/fourslash/shims/getQuickInfoAtPosition.ts @@ -8,6 +8,6 @@ verify.quickInfos({ 1: "var x1: SS", - 2: "var x2: SS<{}>", - 3: "var x3: SS<{}>" + 2: "var x2: SS", + 3: "var x3: SS" }); diff --git a/tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts b/tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts index b1af18469a8..b68c7640476 100644 --- a/tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts +++ b/tests/cases/fourslash/signatureHelpExplicitTypeArguments.ts @@ -9,8 +9,8 @@ verify.signatureHelp( { marker: "1", text: "f(x: number, y: string): number" }, { marker: "2", text: "f(x: boolean, y: string): boolean" }, - // too few -- fill in rest with {} - { marker: "3", text: "f(x: number, y: {}): number" }, + // too few -- fill in rest with unknown + { marker: "3", text: "f(x: number, y: unknown): number" }, // too many -- ignore extra type arguments { marker: "4", text: "f(x: number, y: string): number" }, ); diff --git a/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts b/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts index a3ea10bd0dc..3bd1e2c41f0 100644 --- a/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts +++ b/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts @@ -4,4 +4,4 @@ ////} ////foo(/*1*/ -verify.signatureHelp({ marker: "1", text: "foo(x: number, callback: (x: {}) => number): void" }); +verify.signatureHelp({ marker: "1", text: "foo(x: number, callback: (x: unknown) => number): void" }); diff --git a/tests/cases/fourslash/signatureHelpOnTypePredicates.ts b/tests/cases/fourslash/signatureHelpOnTypePredicates.ts index 1eb0a31c757..04cc1efd5a0 100644 --- a/tests/cases/fourslash/signatureHelpOnTypePredicates.ts +++ b/tests/cases/fourslash/signatureHelpOnTypePredicates.ts @@ -9,6 +9,6 @@ verify.signatureHelp( { marker: "1", text: "f1(a: any): a is number" }, - { marker: "2", text: "f2(a: any): a is {}" }, + { marker: "2", text: "f2(a: any): a is unknown" }, { marker: "3", text: "f3(a: any, ...b: any[]): a is number", isVariadic: true }, ) diff --git a/tests/cases/fourslash/signatureHelpWithTriggers02.ts b/tests/cases/fourslash/signatureHelpWithTriggers02.ts index 7472ba62de8..1f704873427 100644 --- a/tests/cases/fourslash/signatureHelpWithTriggers02.ts +++ b/tests/cases/fourslash/signatureHelpWithTriggers02.ts @@ -9,7 +9,7 @@ goTo.marker("1"); edit.insert("("); verify.signatureHelp({ - text: "bar(x: {}, y: {}): {}", + text: "bar(x: unknown, y: unknown): unknown", triggerReason: { kind: "characterTyped", triggerCharacter: "(", diff --git a/tests/cases/fourslash/staticGenericOverloads1.ts b/tests/cases/fourslash/staticGenericOverloads1.ts index 7b15e6e2a3e..e1be87c3b7a 100644 --- a/tests/cases/fourslash/staticGenericOverloads1.ts +++ b/tests/cases/fourslash/staticGenericOverloads1.ts @@ -15,6 +15,6 @@ verify.signatureHelp({ marker: "", overloadsCount: 2 }); edit.insert('a'); verify.signatureHelp({ overloadsCount: 2, text: "B(v: A): A" }); edit.insert('); A.B('); -verify.signatureHelp({ overloadsCount: 2, text: "B(v: A<{}>): A<{}>" }); +verify.signatureHelp({ overloadsCount: 2, text: "B(v: A): A" }); edit.insert('a'); verify.signatureHelp({ overloadsCount: 2, text: "B(v: A): A" }); From d60c6a02f85004a3efb3f5559936f0340e3b436a Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Fri, 5 Apr 2019 09:06:00 -0700 Subject: [PATCH 44/48] Fix missing baseline diff (#30770) Fixes an odd build break in master --- .../reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt index 1c7b94a0463..9fda31a7cbc 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.errors.txt @@ -222,4 +222,6 @@ tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts(76,50): null, mapDispatchToProps )(TestComponent); + + export {}; \ No newline at end of file From c1f2aba3646a2d48474ce3ee8454621913f4ea2c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 5 Apr 2019 14:37:47 -0700 Subject: [PATCH 45/48] Cache substitution types (#30775) --- src/compiler/checker.ts | 7 +++++++ .../inlinedAliasAssignableToConstraintSameAsAlias.types | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3fe96ca7ac4..1ee59b8862b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -392,6 +392,7 @@ namespace ts { const literalTypes = createMap(); const indexedAccessTypes = createMap(); const conditionalTypes = createMap(); + const substitutionTypes = createMap(); const evolvingArrayTypes: EvolvingArrayType[] = []; const undefinedProperties = createMap() as UnderscoreEscapedMap; @@ -8914,9 +8915,15 @@ namespace ts { if (substitute.flags & TypeFlags.AnyOrUnknown) { return typeVariable; } + const id = `${getTypeId(typeVariable)}>${getTypeId(substitute)}`; + const cached = substitutionTypes.get(id); + if (cached) { + return cached; + } const result = createType(TypeFlags.Substitution); result.typeVariable = typeVariable; result.substitute = substitute; + substitutionTypes.set(id, result); return result; } diff --git a/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types index d337fbc718a..086aa5c976e 100644 --- a/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types +++ b/tests/baselines/reference/inlinedAliasAssignableToConstraintSameAsAlias.types @@ -31,7 +31,7 @@ class A { >z : A[] whereRelated< // Works // Type is same as A1, but is not assignable to type A ->whereRelated : >() => number +>whereRelated : () => number RF extends RelationFields = RelationFields, N extends Name = Name, From 0ddd847e03cb1395c56fed24b930a3a34aba707c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 5 Apr 2019 16:28:25 -0700 Subject: [PATCH 46/48] Small addition to user PR script to support fork/branch PRs --- scripts/open-user-pr.ts | 4 ++-- .../user/TypeScript-Node-Starter/TypeScript-Node-Starter | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/open-user-pr.ts b/scripts/open-user-pr.ts index aedfcc42547..d8b63458c02 100644 --- a/scripts/open-user-pr.ts +++ b/scripts/open-user-pr.ts @@ -20,7 +20,7 @@ function padNum(number: number) { const userName = process.env.GH_USERNAME; const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"] const now = new Date(); -const branchName = `user-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`; +const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`; const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; runSequence([ ["git", ["checkout", "."]], // reset any changes @@ -43,7 +43,7 @@ gh.pulls.create({ maintainer_can_modify: true, title: `🤖 User test baselines have changed`, head: `${userName}:${branchName}`, - base: "master", + base: process.env.TARGET_BRANCH || "master", body: `Please review the diff and merge if no changes are unexpected. You can view the build log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary). diff --git a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter index 46971a84547..40bdb4eadab 160000 --- a/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter +++ b/tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter @@ -1 +1 @@ -Subproject commit 46971a8454761f1a11d8fde4d96ff8d29bc4e754 +Subproject commit 40bdb4eadabc9fbed7d83e3f26817a931c0763b6 From 73616c9725af480012eb4c652ee58ae2c904847a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 5 Apr 2019 17:52:24 -0700 Subject: [PATCH 47/48] More conditional linkage in user PR responses when manually triggered --- scripts/open-user-pr.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/open-user-pr.ts b/scripts/open-user-pr.ts index d8b63458c02..a0c25689aa4 100644 --- a/scripts/open-user-pr.ts +++ b/scripts/open-user-pr.ts @@ -18,7 +18,10 @@ function padNum(number: number) { } const userName = process.env.GH_USERNAME; -const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"] +const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"]; +if (process.env.requesting_user && reviewers.indexOf(process.env.requesting_user) === -1) { + reviewers.push(process.env.requesting_user); +} const now = new Date(); const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`; const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; @@ -41,23 +44,31 @@ gh.pulls.create({ owner: process.env.TARGET_FORK, repo: "TypeScript", maintainer_can_modify: true, - title: `🤖 User test baselines have changed`, + title: `🤖 User test baselines have changed` + (process.env.TARGET_BRANCH ? ` for ${process.env.TARGET_BRANCH}` : ""), head: `${userName}:${branchName}`, base: process.env.TARGET_BRANCH || "master", body: -`Please review the diff and merge if no changes are unexpected. +`${process.env.source_issue ? `This test run was triggerd by a request on https://github.com/Microsoft/TypeScript/pull/${process.env.source_issue} `+"\n" : ""}Please review the diff and merge if no changes are unexpected. You can view the build log [here](https://typescript.visualstudio.com/TypeScript/_build/index?buildId=${process.env.BUILD_BUILDID}&_a=summary). cc ${reviewers.map(r => "@" + r).join(" ")}`, -}).then(r => { +}).then(async r => { const num = r.data.number; console.log(`Pull request ${num} created.`); - return gh.pulls.createReviewRequest({ + await gh.pulls.createReviewRequest({ owner: process.env.TARGET_FORK, repo: "TypeScript", number: num, reviewers, }); + if (process.env.source_issue) { + await gh.issues.createComment({ + number: +process.env.source_issue, + owner: "Microsoft", + repo: "TypeScript", + body: `The user suite test run you requested has finished and _failed_. I've opened a [PR with the baseline diff from master](${r.data.html_url}).` + }); + } }).then(() => { console.log(`Reviewers requested, done.`); }).catch(e => { From 60346b56a8efbb88dca06c3b4a9dddf72c9c3205 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 5 Apr 2019 18:29:30 -0700 Subject: [PATCH 48/48] Do not request reviewers for fork-triggered PRs, just mention them --- scripts/open-user-pr.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/open-user-pr.ts b/scripts/open-user-pr.ts index a0c25689aa4..9c582ad9895 100644 --- a/scripts/open-user-pr.ts +++ b/scripts/open-user-pr.ts @@ -18,10 +18,7 @@ function padNum(number: number) { } const userName = process.env.GH_USERNAME; -const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"]; -if (process.env.requesting_user && reviewers.indexOf(process.env.requesting_user) === -1) { - reviewers.push(process.env.requesting_user); -} +const reviewers = process.env.requesting_user ? [process.env.requesting_user] : ["weswigham", "sandersn", "RyanCavanaugh"]; const now = new Date(); const branchName = `user-update-${process.env.TARGET_FORK}-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}${process.env.TARGET_BRANCH ? "-" + process.env.TARGET_BRANCH : ""}`; const remoteUrl = `https://${process.argv[2]}@github.com/${userName}/TypeScript.git`; @@ -55,13 +52,15 @@ cc ${reviewers.map(r => "@" + r).join(" ")}`, }).then(async r => { const num = r.data.number; console.log(`Pull request ${num} created.`); - await gh.pulls.createReviewRequest({ - owner: process.env.TARGET_FORK, - repo: "TypeScript", - number: num, - reviewers, - }); - if (process.env.source_issue) { + if (!process.env.source_issue) { + await gh.pulls.createReviewRequest({ + owner: process.env.TARGET_FORK, + repo: "TypeScript", + number: num, + reviewers, + }); + } + else { await gh.issues.createComment({ number: +process.env.source_issue, owner: "Microsoft",