From 426a63e8b6a98b2f6ff7eeddf98f0653582c744f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 15 May 2018 12:24:40 -0700 Subject: [PATCH 01/30] Optimize intersections of unions of unit types --- src/compiler/checker.ts | 32 ++++++++++++++++++++++++++++---- src/compiler/types.ts | 4 ++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index caa75a45eb9..705ecea6b5e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8319,7 +8319,7 @@ namespace ts { includes & TypeFlags.Undefined ? includes & TypeFlags.NonWideningType ? undefinedType : undefinedWideningType : neverType; } - return getUnionTypeFromSortedList(typeSet, aliasSymbol, aliasTypeArguments); + return getUnionTypeFromSortedList(typeSet, includes & TypeFlags.NotUnit ? 0 : TypeFlags.UnionOfUnitTypes, aliasSymbol, aliasTypeArguments); } function getUnionTypePredicate(signatures: ReadonlyArray): TypePredicate { @@ -8359,7 +8359,7 @@ namespace ts { } // This function assumes the constituent type list is sorted and deduplicated. - function getUnionTypeFromSortedList(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type { + function getUnionTypeFromSortedList(types: Type[], unionOfUnitTypes: TypeFlags, aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type { if (types.length === 0) { return neverType; } @@ -8370,7 +8370,7 @@ namespace ts { let type = unionTypes.get(id); if (!type) { const propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); - type = createType(TypeFlags.Union | propagatedFlags); + type = createType(TypeFlags.Union | propagatedFlags | unionOfUnitTypes); unionTypes.set(id, type); type.types = types; /* @@ -8441,6 +8441,27 @@ namespace ts { } } + // When intersecting unions of unit types we can simply intersect based on type identity. + // Here we remove all unions of unit types from the given list and replace them with a + // a single union containing an intersection of the unit types. + function intersectUnionsOfUnitTypes(types: Type[]) { + const unionIndex = findIndex(types, t => (t.flags & TypeFlags.UnionOfUnitTypes) !== 0); + const unionType = types[unionIndex]; + let intersection = unionType.types; + let i = types.length - 1; + while (i > unionIndex) { + const t = types[i]; + if (t.flags & TypeFlags.UnionOfUnitTypes) { + intersection = filter(intersection, u => containsType((t).types, u)); + orderedRemoveItemAt(types, i); + } + i--; + } + if (intersection !== unionType.types) { + types[unionIndex] = getUnionTypeFromSortedList(intersection, unionType.flags & TypeFlags.UnionOfUnitTypes); + } + } + // We normalize combinations of intersection and union types based on the distributive property of the '&' // operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection // types with union type constituents into equivalent union types with intersection type constituents and @@ -8468,6 +8489,9 @@ namespace ts { includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) { removeRedundantPrimitiveTypes(typeSet, includes); } + if (includes & TypeFlags.UnionOfUnitTypes) { + intersectUnionsOfUnitTypes(typeSet); + } if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object)) { typeSet.push(emptyObjectType); } @@ -13234,7 +13258,7 @@ namespace ts { if (type.flags & TypeFlags.Union) { const types = (type).types; const filtered = filter(types, f); - return filtered === types ? type : getUnionTypeFromSortedList(filtered); + return filtered === types ? type : getUnionTypeFromSortedList(filtered, type.flags & TypeFlags.UnionOfUnitTypes); } return f(type) ? type : neverType; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 4b2a7c080d2..84844c437aa 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3674,6 +3674,8 @@ namespace ts { ContainsAnyFunctionType = 1 << 26, // Type is or contains the anyFunctionType NonPrimitive = 1 << 27, // intrinsic object type /* @internal */ + UnionOfUnitTypes = 1 << 28, // Type is union of unit types + /* @internal */ GenericMappedType = 1 << 29, // Flag used by maybeTypeOfKind /* @internal */ @@ -3711,6 +3713,8 @@ namespace ts { Narrowable = Any | StructuredOrInstantiable | StringLike | NumberLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, NotUnionOrUnit = Any | ESSymbol | Object | NonPrimitive, /* @internal */ + NotUnit = Any | String | Number | Boolean | Enum | ESSymbol | Void | Never | StructuredOrInstantiable, + /* @internal */ RequiresWidening = ContainsWideningType | ContainsObjectLiteral, /* @internal */ PropagatingFlags = ContainsWideningType | ContainsObjectLiteral | ContainsAnyFunctionType, From 1c3dbd4f4b135f4153891f56482eeb111c3fa555 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 15 May 2018 12:34:29 -0700 Subject: [PATCH 02/30] Add regression test --- .../compiler/intersectionsOfLargeUnions.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/cases/compiler/intersectionsOfLargeUnions.ts diff --git a/tests/cases/compiler/intersectionsOfLargeUnions.ts b/tests/cases/compiler/intersectionsOfLargeUnions.ts new file mode 100644 index 00000000000..1c8949873f4 --- /dev/null +++ b/tests/cases/compiler/intersectionsOfLargeUnions.ts @@ -0,0 +1,27 @@ +// @strict: true + +// Repro from #23977 + +export function assertIsElement(node: Node | null): node is Element { + let nodeType = node === null ? null : node.nodeType; + return nodeType === 1; +} + +export function assertNodeTagName< + T extends keyof ElementTagNameMap, + U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U { + if (assertIsElement(node)) { + const nodeTagName = node.tagName.toLowerCase(); + return nodeTagName === tagName; + } + return false; +} + +export function assertNodeProperty< + T extends keyof ElementTagNameMap, + P extends keyof ElementTagNameMap[T], + V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) { + if (assertNodeTagName(node, tagName)) { + node[prop]; + } +} From 8b6e85347d4d8c9e84261107981665c6688d1dbf Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 15 May 2018 12:34:41 -0700 Subject: [PATCH 03/30] Accept new baselines --- .../intersectionsOfLargeUnions.errors.txt | 35 ++++++ .../reference/intersectionsOfLargeUnions.js | 51 ++++++++ .../intersectionsOfLargeUnions.symbols | 95 +++++++++++++++ .../intersectionsOfLargeUnions.types | 110 ++++++++++++++++++ 4 files changed, 291 insertions(+) create mode 100644 tests/baselines/reference/intersectionsOfLargeUnions.errors.txt create mode 100644 tests/baselines/reference/intersectionsOfLargeUnions.js create mode 100644 tests/baselines/reference/intersectionsOfLargeUnions.symbols create mode 100644 tests/baselines/reference/intersectionsOfLargeUnions.types diff --git a/tests/baselines/reference/intersectionsOfLargeUnions.errors.txt b/tests/baselines/reference/intersectionsOfLargeUnions.errors.txt new file mode 100644 index 00000000000..b5911f646c7 --- /dev/null +++ b/tests/baselines/reference/intersectionsOfLargeUnions.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/intersectionsOfLargeUnions.ts(21,15): error TS2536: Type 'T' cannot be used to index type 'HTMLElementTagNameMap'. +tests/cases/compiler/intersectionsOfLargeUnions.ts(21,15): error TS2536: Type 'P' cannot be used to index type 'HTMLElementTagNameMap[T]'. + + +==== tests/cases/compiler/intersectionsOfLargeUnions.ts (2 errors) ==== + // Repro from #23977 + + export function assertIsElement(node: Node | null): node is Element { + let nodeType = node === null ? null : node.nodeType; + return nodeType === 1; + } + + export function assertNodeTagName< + T extends keyof ElementTagNameMap, + U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U { + if (assertIsElement(node)) { + const nodeTagName = node.tagName.toLowerCase(); + return nodeTagName === tagName; + } + return false; + } + + export function assertNodeProperty< + T extends keyof ElementTagNameMap, + P extends keyof ElementTagNameMap[T], + V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) { + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2536: Type 'T' cannot be used to index type 'HTMLElementTagNameMap'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2536: Type 'P' cannot be used to index type 'HTMLElementTagNameMap[T]'. + if (assertNodeTagName(node, tagName)) { + node[prop]; + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/intersectionsOfLargeUnions.js b/tests/baselines/reference/intersectionsOfLargeUnions.js new file mode 100644 index 00000000000..bd3b98daf01 --- /dev/null +++ b/tests/baselines/reference/intersectionsOfLargeUnions.js @@ -0,0 +1,51 @@ +//// [intersectionsOfLargeUnions.ts] +// Repro from #23977 + +export function assertIsElement(node: Node | null): node is Element { + let nodeType = node === null ? null : node.nodeType; + return nodeType === 1; +} + +export function assertNodeTagName< + T extends keyof ElementTagNameMap, + U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U { + if (assertIsElement(node)) { + const nodeTagName = node.tagName.toLowerCase(); + return nodeTagName === tagName; + } + return false; +} + +export function assertNodeProperty< + T extends keyof ElementTagNameMap, + P extends keyof ElementTagNameMap[T], + V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) { + if (assertNodeTagName(node, tagName)) { + node[prop]; + } +} + + +//// [intersectionsOfLargeUnions.js] +"use strict"; +// Repro from #23977 +exports.__esModule = true; +function assertIsElement(node) { + var nodeType = node === null ? null : node.nodeType; + return nodeType === 1; +} +exports.assertIsElement = assertIsElement; +function assertNodeTagName(node, tagName) { + if (assertIsElement(node)) { + var nodeTagName = node.tagName.toLowerCase(); + return nodeTagName === tagName; + } + return false; +} +exports.assertNodeTagName = assertNodeTagName; +function assertNodeProperty(node, tagName, prop, value) { + if (assertNodeTagName(node, tagName)) { + node[prop]; + } +} +exports.assertNodeProperty = assertNodeProperty; diff --git a/tests/baselines/reference/intersectionsOfLargeUnions.symbols b/tests/baselines/reference/intersectionsOfLargeUnions.symbols new file mode 100644 index 00000000000..02bcce61609 --- /dev/null +++ b/tests/baselines/reference/intersectionsOfLargeUnions.symbols @@ -0,0 +1,95 @@ +=== tests/cases/compiler/intersectionsOfLargeUnions.ts === +// Repro from #23977 + +export function assertIsElement(node: Node | null): node is Element { +>assertIsElement : Symbol(assertIsElement, Decl(intersectionsOfLargeUnions.ts, 0, 0)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 2, 32)) +>Node : Symbol(Node, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 2, 32)) +>Element : Symbol(Element, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + let nodeType = node === null ? null : node.nodeType; +>nodeType : Symbol(nodeType, Decl(intersectionsOfLargeUnions.ts, 3, 7)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 2, 32)) +>node.nodeType : Symbol(Node.nodeType, Decl(lib.d.ts, --, --)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 2, 32)) +>nodeType : Symbol(Node.nodeType, Decl(lib.d.ts, --, --)) + + return nodeType === 1; +>nodeType : Symbol(nodeType, Decl(intersectionsOfLargeUnions.ts, 3, 7)) +} + +export function assertNodeTagName< +>assertNodeTagName : Symbol(assertNodeTagName, Decl(intersectionsOfLargeUnions.ts, 5, 1)) + + T extends keyof ElementTagNameMap, +>T : Symbol(T, Decl(intersectionsOfLargeUnions.ts, 7, 34)) +>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.d.ts, --, --)) + + U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U { +>U : Symbol(U, Decl(intersectionsOfLargeUnions.ts, 8, 38)) +>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(intersectionsOfLargeUnions.ts, 7, 34)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 9, 36)) +>Node : Symbol(Node, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions.ts, 9, 54)) +>T : Symbol(T, Decl(intersectionsOfLargeUnions.ts, 7, 34)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 9, 36)) +>U : Symbol(U, Decl(intersectionsOfLargeUnions.ts, 8, 38)) + + if (assertIsElement(node)) { +>assertIsElement : Symbol(assertIsElement, Decl(intersectionsOfLargeUnions.ts, 0, 0)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 9, 36)) + + const nodeTagName = node.tagName.toLowerCase(); +>nodeTagName : Symbol(nodeTagName, Decl(intersectionsOfLargeUnions.ts, 11, 13)) +>node.tagName.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) +>node.tagName : Symbol(Element.tagName, Decl(lib.d.ts, --, --)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 9, 36)) +>tagName : Symbol(Element.tagName, Decl(lib.d.ts, --, --)) +>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) + + return nodeTagName === tagName; +>nodeTagName : Symbol(nodeTagName, Decl(intersectionsOfLargeUnions.ts, 11, 13)) +>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions.ts, 9, 54)) + } + return false; +} + +export function assertNodeProperty< +>assertNodeProperty : Symbol(assertNodeProperty, Decl(intersectionsOfLargeUnions.ts, 15, 1)) + + T extends keyof ElementTagNameMap, +>T : Symbol(T, Decl(intersectionsOfLargeUnions.ts, 17, 35)) +>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.d.ts, --, --)) + + P extends keyof ElementTagNameMap[T], +>P : Symbol(P, Decl(intersectionsOfLargeUnions.ts, 18, 38)) +>ElementTagNameMap : Symbol(ElementTagNameMap, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(intersectionsOfLargeUnions.ts, 17, 35)) + + V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) { +>V : Symbol(V, Decl(intersectionsOfLargeUnions.ts, 19, 41)) +>HTMLElementTagNameMap : Symbol(HTMLElementTagNameMap, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(intersectionsOfLargeUnions.ts, 17, 35)) +>P : Symbol(P, Decl(intersectionsOfLargeUnions.ts, 18, 38)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 20, 43)) +>Node : Symbol(Node, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions.ts, 20, 61)) +>T : Symbol(T, Decl(intersectionsOfLargeUnions.ts, 17, 35)) +>prop : Symbol(prop, Decl(intersectionsOfLargeUnions.ts, 20, 73)) +>P : Symbol(P, Decl(intersectionsOfLargeUnions.ts, 18, 38)) +>value : Symbol(value, Decl(intersectionsOfLargeUnions.ts, 20, 82)) +>V : Symbol(V, Decl(intersectionsOfLargeUnions.ts, 19, 41)) + + if (assertNodeTagName(node, tagName)) { +>assertNodeTagName : Symbol(assertNodeTagName, Decl(intersectionsOfLargeUnions.ts, 5, 1)) +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 20, 43)) +>tagName : Symbol(tagName, Decl(intersectionsOfLargeUnions.ts, 20, 61)) + + node[prop]; +>node : Symbol(node, Decl(intersectionsOfLargeUnions.ts, 20, 43)) +>prop : Symbol(prop, Decl(intersectionsOfLargeUnions.ts, 20, 73)) + } +} + diff --git a/tests/baselines/reference/intersectionsOfLargeUnions.types b/tests/baselines/reference/intersectionsOfLargeUnions.types new file mode 100644 index 00000000000..4deef4a4ecf --- /dev/null +++ b/tests/baselines/reference/intersectionsOfLargeUnions.types @@ -0,0 +1,110 @@ +=== tests/cases/compiler/intersectionsOfLargeUnions.ts === +// Repro from #23977 + +export function assertIsElement(node: Node | null): node is Element { +>assertIsElement : (node: Node | null) => node is Element +>node : Node | null +>Node : Node +>null : null +>node : any +>Element : Element + + let nodeType = node === null ? null : node.nodeType; +>nodeType : number | null +>node === null ? null : node.nodeType : number | null +>node === null : boolean +>node : Node | null +>null : null +>null : null +>node.nodeType : number +>node : Node +>nodeType : number + + return nodeType === 1; +>nodeType === 1 : boolean +>nodeType : number | null +>1 : 1 +} + +export function assertNodeTagName< +>assertNodeTagName : (node: Node | null, tagName: T) => node is U + + T extends keyof ElementTagNameMap, +>T : T +>ElementTagNameMap : ElementTagNameMap + + U extends ElementTagNameMap[T]>(node: Node | null, tagName: T): node is U { +>U : U +>ElementTagNameMap : ElementTagNameMap +>T : T +>node : Node | null +>Node : Node +>null : null +>tagName : T +>T : T +>node : any +>U : U + + if (assertIsElement(node)) { +>assertIsElement(node) : boolean +>assertIsElement : (node: Node | null) => node is Element +>node : Node | null + + const nodeTagName = node.tagName.toLowerCase(); +>nodeTagName : string +>node.tagName.toLowerCase() : string +>node.tagName.toLowerCase : () => string +>node.tagName : string +>node : Element +>tagName : string +>toLowerCase : () => string + + return nodeTagName === tagName; +>nodeTagName === tagName : boolean +>nodeTagName : string +>tagName : T + } + return false; +>false : false +} + +export function assertNodeProperty< +>assertNodeProperty : (node: Node | null, tagName: T, prop: P, value: V) => void + + T extends keyof ElementTagNameMap, +>T : T +>ElementTagNameMap : ElementTagNameMap + + P extends keyof ElementTagNameMap[T], +>P : P +>ElementTagNameMap : ElementTagNameMap +>T : T + + V extends HTMLElementTagNameMap[T][P]>(node: Node | null, tagName: T, prop: P, value: V) { +>V : V +>HTMLElementTagNameMap : HTMLElementTagNameMap +>T : T +>P : P +>node : Node | null +>Node : Node +>null : null +>tagName : T +>T : T +>prop : P +>P : P +>value : V +>V : V + + if (assertNodeTagName(node, tagName)) { +>assertNodeTagName(node, tagName) : boolean +>assertNodeTagName : (node: Node | null, tagName: T) => node is U +>node : Node | null +>tagName : T + + node[prop]; +>node[prop] : ElementTagNameMap[T][P] +>node : ElementTagNameMap[T] +>prop : P + } +} + From 7c52cab219ef103b8e251d6b498fc8e94986f034 Mon Sep 17 00:00:00 2001 From: csigs Date: Wed, 16 May 2018 22:11:01 +0000 Subject: [PATCH 04/30] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 3 ++ .../diagnosticMessages.generated.json.lcl | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1b6070bf4ba..40bfcf5873f 100644 --- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -6582,6 +6582,9 @@ + + + diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 636853315c0..4c1b7b81a50 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -3102,6 +3102,9 @@ + + + @@ -5286,6 +5289,15 @@ + + + + + + + + + @@ -6552,6 +6564,15 @@ + + + + + + + + + @@ -6582,6 +6603,15 @@ + + + + + + + + + From 6af5d8b94094af82aa79702b117e55581a34a2ab Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 16 May 2018 15:44:59 -0700 Subject: [PATCH 05/30] Add Unicode ThirdPartyNotice --- ThirdPartyNoticeText.txt | 91 +++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 15 deletions(-) diff --git a/ThirdPartyNoticeText.txt b/ThirdPartyNoticeText.txt index a9ffbddbd89..b82f2497a6c 100644 --- a/ThirdPartyNoticeText.txt +++ b/ThirdPartyNoticeText.txt @@ -1,35 +1,96 @@ /*!----------------- TypeScript ThirdPartyNotices ------------------------------------------------------- -The TypeScript software is based on or incorporates material and code from the projects listed below -(collectively "Third Party Code"). Microsoft is not the original author of the -Third Party Code. The original copyright notice and the license, under which -Microsoft received such Third Party Code, are set forth below. Such license and -notices are provided for informational purposes only. Microsoft licenses the Third +The TypeScript software is based on or incorporates material and code from the projects listed below +(collectively "Third Party Code"). Microsoft is not the original author of the +Third Party Code. The original copyright notice and the license, under which +Microsoft received such Third Party Code, are set forth below. Such license and +notices are provided for informational purposes only. Microsoft licenses the Third Party Code to you under the terms of the Apache 2.0 License. -All Third Party Code licensed by Microsoft under the Apache License, Version 2.0 (the "License"); you -may not use this file except in compliance with the License. You may obtain a copy +All Third Party Code licensed by Microsoft under the Apache License, Version 2.0 (the "License"); you +may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR -CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR +CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. -See the Apache Version 2.0 License for specific language governing permissions and +See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. --------------------------------------------- Third Party Code Components -------------------------------------------- ------------------- DefinitelyTyped -------------------- -This file is based on or incorporates material from the projects listed below (collectively "Third Party Code"). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. +This file is based on or incorporates material from the projects listed below (collectively "Third Party Code"). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. DefinitelyTyped This project is licensed under the MIT license. Copyrights are respective of each contributor listed at the beginning of each definition file. Provided for Informational Purposes Only - -MIT License -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +MIT License +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------------- + +------------------- Unicode -------------------- +UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + +Unicode Data Files include all data files under the directories +http://www.unicode.org/Public/, http://www.unicode.org/reports/, +http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and +http://www.unicode.org/utility/trac/browser/. + +Unicode Data Files do not include PDF online code charts under the +directory http://www.unicode.org/Public/. + +Software includes any source code published in the Unicode Standard +or under the directories +http://www.unicode.org/Public/, http://www.unicode.org/reports/, +http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and +http://www.unicode.org/utility/trac/browser/. + +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1991-2017 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in http://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. +-------------------------------------------------------------------------------------- + ------------- End of ThirdPartyNotices --------------------------------------------------- */ From 027829fbcd0a84172ab4a36d60a0ac915ca7ea09 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 16 May 2018 16:26:37 -0700 Subject: [PATCH 06/30] Properly handle edge cases --- src/compiler/checker.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 705ecea6b5e..864ce12a6f9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8457,9 +8457,11 @@ namespace ts { } i--; } - if (intersection !== unionType.types) { - types[unionIndex] = getUnionTypeFromSortedList(intersection, unionType.flags & TypeFlags.UnionOfUnitTypes); + if (intersection === unionType.types) { + return false; } + types[unionIndex] = getUnionTypeFromSortedList(intersection, unionType.flags & TypeFlags.UnionOfUnitTypes); + return true; } // We normalize combinations of intersection and union types based on the distributive property of the '&' @@ -8489,9 +8491,6 @@ namespace ts { includes & TypeFlags.ESSymbol && includes & TypeFlags.UniqueESSymbol) { removeRedundantPrimitiveTypes(typeSet, includes); } - if (includes & TypeFlags.UnionOfUnitTypes) { - intersectUnionsOfUnitTypes(typeSet); - } if (includes & TypeFlags.EmptyObject && !(includes & TypeFlags.Object)) { typeSet.push(emptyObjectType); } @@ -8499,6 +8498,12 @@ namespace ts { return typeSet[0]; } if (includes & TypeFlags.Union) { + if (includes & TypeFlags.UnionOfUnitTypes && intersectUnionsOfUnitTypes(typeSet)) { + // When the intersection creates a reduced set (which might mean that *all* union types have + // disappeared), we restart the operation to get a new set of combined flags. Once we have + // reduced we'll never reduce again, so this occurs at most once. + return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); + } // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. const unionIndex = findIndex(typeSet, t => (t.flags & TypeFlags.Union) !== 0); From 159c808a0df745bd3cadfee41ec085f6e3fb5773 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 16 May 2018 18:17:59 -0700 Subject: [PATCH 07/30] Sort the whole diagnostic, plus giving up on isolating tests (#24186) * Sort the whole diagnostic * Also strip references to our repos node_modules, since removing it is hard --- src/harness/externalCompileRunner.ts | 36 +++++++--------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/src/harness/externalCompileRunner.ts b/src/harness/externalCompileRunner.ts index 8cc5201228f..eac5d92d3e4 100644 --- a/src/harness/externalCompileRunner.ts +++ b/src/harness/externalCompileRunner.ts @@ -31,32 +31,9 @@ abstract class ExternalCompileRunnerBase extends RunnerBase { const cls = this; describe(`${this.kind()} code samples`, function(this: Mocha.ISuiteCallbackContext) { this.timeout(600_000); // 10 minutes - const cwd = path.join(Harness.IO.getWorkspaceRoot(), cls.testDir); - const placeholderName = ".node_modules"; - const moduleDirName = "node_modules"; - before(() => { - ts.forEachAncestorDirectory(cwd, dir => { - try { - fs.renameSync(path.join(dir, moduleDirName), path.join(dir, placeholderName)); - } - catch { - // empty - } - }); - }); for (const test of testList) { cls.runTest(typeof test === "string" ? test : test.file); } - after(() => { - ts.forEachAncestorDirectory(cwd, dir => { - try { - fs.renameSync(path.join(dir, placeholderName), path.join(dir, moduleDirName)); - } - catch { - // empty - } - }); - }); }); } private runTest(directoryName: string) { @@ -137,14 +114,16 @@ ${stripAbsoluteImportPaths(result.stderr.toString().replace(/\r\n/g, "\n"))}`; function stripAbsoluteImportPaths(result: string) { return result .replace(/import\(".*?\/tests\/cases\/user\//g, `import("/`) - .replace(/Module '".*?\/tests\/cases\/user\//g, `Module '"/`); + .replace(/Module '".*?\/tests\/cases\/user\//g, `Module '"/`) + .replace(/import\(".*?\/TypeScript\/node_modules\//g, `import("../../../node_modules`) + .replace(/Module '".*?\/TypeScript\/node_modules\//g, `Module '"../../../node_modules`); } function sortErrors(result: string) { return ts.flatten(splitBy(result.split("\n"), s => /^\S+/.test(s)).sort(compareErrorStrings)).join("\n"); } -const errorRegexp = /^(.+\.[tj]sx?)\((\d+),(\d+)\): error TS/; +const errorRegexp = /^(.+\.[tj]sx?)\((\d+),(\d+)\)(: error TS.*)/; function compareErrorStrings(a: string[], b: string[]) { ts.Debug.assertGreaterThanOrEqual(a.length, 1); ts.Debug.assertGreaterThanOrEqual(b.length, 1); @@ -156,11 +135,12 @@ function compareErrorStrings(a: string[], b: string[]) { if (!matchB) { return 1; } - const [, errorFileA, lineNumberStringA, columnNumberStringA] = matchA; - const [, errorFileB, lineNumberStringB, columnNumberStringB] = matchB; + const [, errorFileA, lineNumberStringA, columnNumberStringA, remainderA] = matchA; + const [, errorFileB, lineNumberStringB, columnNumberStringB, remainderB] = matchB; return ts.comparePathsCaseSensitive(errorFileA, errorFileB) || ts.compareValues(parseInt(lineNumberStringA), parseInt(lineNumberStringB)) || - ts.compareValues(parseInt(columnNumberStringA), parseInt(columnNumberStringB)); + ts.compareValues(parseInt(columnNumberStringA), parseInt(columnNumberStringB)) || + ts.compareStringsCaseSensitive(remainderA, remainderB); } class DefinitelyTypedRunner extends ExternalCompileRunnerBase { From 755b443b6dfe6bcf8b08c1af502d834ee0bb9d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E7=92=90?= Date: Thu, 17 May 2018 10:18:20 +0800 Subject: [PATCH 08/30] disallow acesssor generate in function like initializer --- .../generateGetAccessorAndSetAccessor.ts | 7 ++++- ...efactorConvertToGetAccessAndSetAccess35.ts | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index ca94d10e80f..d68a052eca9 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -119,7 +119,12 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { function getConvertibleFieldAtPosition(file: SourceFile, startPosition: number): Info | undefined { const node = getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); - const declaration = findAncestor(node.parent, isAcceptedDeclaration); + const declaration = findAncestor(node.parent, n => { + if (isFunctionLikeDeclaration(n)) { + return "quit"; + } + return isAcceptedDeclaration(n); + }); // make sure declaration have AccessibilityModifier or Static Modifier or Readonly Modifier const meaning = ModifierFlags.AccessibilityModifier | ModifierFlags.Static | ModifierFlags.Readonly; if (!declaration || !isConvertableName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined; diff --git a/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts b/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts new file mode 100644 index 00000000000..f1b306fa4b9 --- /dev/null +++ b/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts @@ -0,0 +1,29 @@ +/// + +//// class A { +//// /*a*/public/*b*/ /*c*/a/*d*/ = () => { +//// /*e*/return/*f*/ /*g*/1/*h*/; +//// } +//// /*i*/b/*j*/: /*k*/number/*l*/ = /*m*/1/*n*/ +//// }; + +goTo.select("a", "b"); +verify.refactorAvailable("Generate 'get' and 'set' accessors"); + +goTo.select("c", "d"); +verify.refactorAvailable("Generate 'get' and 'set' accessors"); + +goTo.select("e", "f"); +verify.not.refactorAvailable("Generate 'get' and 'set' accessors"); + +goTo.select("g", "h"); +verify.not.refactorAvailable("Generate 'get' and 'set' accessors"); + +goTo.select("i", "j"); +verify.refactorAvailable("Generate 'get' and 'set' accessors"); + +goTo.select("k", "l"); +verify.refactorAvailable("Generate 'get' and 'set' accessors"); + +goTo.select("m", "n"); +verify.refactorAvailable("Generate 'get' and 'set' accessors"); \ No newline at end of file From 63a72636a90718d408aa631fbc5b422dcceee8ea Mon Sep 17 00:00:00 2001 From: csigs Date: Thu, 17 May 2018 04:10:22 +0000 Subject: [PATCH 09/30] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 9 ++++++ .../diagnosticMessages.generated.json.lcl | 30 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl index 40bfcf5873f..ea95d1bda8c 100644 --- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -3090,6 +3090,9 @@ + + + @@ -5277,6 +5280,9 @@ + + + @@ -6546,6 +6552,9 @@ + + + diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 420331075cf..e279a6d066c 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -3086,6 +3086,9 @@ + + + @@ -5270,6 +5273,15 @@ + + + + + + + + + @@ -6536,6 +6548,15 @@ + + + + + + + + + @@ -6566,6 +6587,15 @@ + + + + + + + + + From 5d233054c36b1e4b9180dcfba04920dcd80723e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E7=92=90?= Date: Thu, 17 May 2018 16:35:11 +0800 Subject: [PATCH 10/30] add quick fix for import type missing typeof --- src/compiler/diagnosticMessages.json | 4 +++ src/harness/tsconfig.json | 1 + src/server/tsconfig.json | 1 + src/server/tsconfig.library.json | 1 + .../fixAddModuleReferTypeMissingTypeof.ts | 32 +++++++++++++++++++ src/services/tsconfig.json | 1 + .../fourslash/codeFixAddMissingTypeof1.ts | 16 ++++++++++ .../fourslash/codeFixAddMissingTypeof2.ts | 13 ++++++++ 8 files changed, 69 insertions(+) create mode 100644 src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts create mode 100644 tests/cases/fourslash/codeFixAddMissingTypeof1.ts create mode 100644 tests/cases/fourslash/codeFixAddMissingTypeof2.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 2956faef0b3..61961913280 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4257,5 +4257,9 @@ "Remove all unreachable code": { "category": "Message", "code": 95051 + }, + "Add missing typeof": { + "category": "Message", + "code": 95052 } } diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index 4a95cd44928..4fb96dbe93d 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -116,6 +116,7 @@ "../services/codefixes/moduleSpecifiers.ts", "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", + "../services/codefixes/fixAddModuleReferTypeMissingTypeof.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", "../services/refactors/moveToNewFile.ts", diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index fee3a872370..50e06eb3f23 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -112,6 +112,7 @@ "../services/codefixes/moduleSpecifiers.ts", "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", + "../services/codefixes/fixAddModuleReferTypeMissingTypeof.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", "../services/refactors/moveToNewFile.ts", diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index b87bf9b5e92..43e8fd1857b 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -118,6 +118,7 @@ "../services/codefixes/moduleSpecifiers.ts", "../services/codefixes/requireInTs.ts", "../services/codefixes/useDefaultImport.ts", + "../services/codefixes/fixAddModuleReferTypeMissingTypeof.ts", "../services/refactors/extractSymbol.ts", "../services/refactors/generateGetAccessorAndSetAccessor.ts", "../services/refactors/moveToNewFile.ts", diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts new file mode 100644 index 00000000000..8b58dba5450 --- /dev/null +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -0,0 +1,32 @@ +/* @internal */ +namespace ts.codefix { + const fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof"; + const fixId = fixIdAddMissingTypeof; + const errorCodes = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here.code]; + registerCodeFix({ + errorCodes, + getCodeActions: context => { + const { sourceFile, span } = context; + const typeContainer = getImportTypeNode(sourceFile, span.start); + if (!typeContainer) return undefined; + + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, typeContainer)); + return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_typeof, fixId, Diagnostics.Add_missing_typeof)]; + }, + fixIds: [fixId], + getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => + doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start!))), + }); + + function getImportTypeNode(sourceFile: SourceFile, pos: number): ImportTypeNode | undefined { + const token = getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false); + Debug.assert(token.kind === SyntaxKind.ImportKeyword); + Debug.assert(token.parent.kind === SyntaxKind.ImportType); + return token.parent; + } + + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, typeContainer: ImportTypeNode) { + const newTypeNode = updateImportTypeNode(typeContainer, typeContainer.argument, typeContainer.qualifier, typeContainer.typeArguments, /* isTypeOf */ true); + changes.replaceNode(sourceFile, typeContainer, newTypeNode); + } +} diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 0fe4b16e2ac..d78086504c9 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -109,6 +109,7 @@ "codefixes/moduleSpecifiers.ts", "codefixes/requireInTs.ts", "codefixes/useDefaultImport.ts", + "codefixes/fixAddModuleReferTypeMissingTypeof.ts", "refactors/extractSymbol.ts", "refactors/generateGetAccessorAndSetAccessor.ts", "refactors/moveToNewFile.ts", diff --git a/tests/cases/fourslash/codeFixAddMissingTypeof1.ts b/tests/cases/fourslash/codeFixAddMissingTypeof1.ts new file mode 100644 index 00000000000..ab728c07455 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingTypeof1.ts @@ -0,0 +1,16 @@ +/// + +//// declare module "foo" { +//// const a = "foo" +//// export = a +//// } +//// const x: import("foo") = import("foo"); + +verify.codeFix({ + description: "Add missing typeof", + newFileContent: `declare module "foo" { + const a = "foo" + export = a +} +const x: typeof import("foo") = import("foo");` +}); diff --git a/tests/cases/fourslash/codeFixAddMissingTypeof2.ts b/tests/cases/fourslash/codeFixAddMissingTypeof2.ts new file mode 100644 index 00000000000..bb863e8db37 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingTypeof2.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: a.ts +//// export = 1; + +// @Filename: b.ts +//// const a: import("./a") = import("./a") + +goTo.file("b.ts") +verify.codeFix({ + description: "Add missing typeof", + newFileContent: `const a: typeof import("./a") = import("./a")` +}); From aa7e2b0f076dca09a157f9cc6a4ecbf7680baa33 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 17 May 2018 09:28:11 -0700 Subject: [PATCH 11/30] Add callback tag, with type parameters (#23947) * Add initial tests * Add types * Half of parsing (builds but does not pass tests) * Parsing done; types are uglier; doesn't crash but doesn't pass * Bind callback tag Builds but tests still don't pass * Only bind param tags inside callback tags * Fix binding switch to only handle param tags once * Checking is 1/3 done or so. Now I'm going to go rename some members to be more uniform. I hate unnnecessary conditionals. * Rename typeExpression to type (for some jsdoc) (maybe I'll rename more later) * Rename the rest of typeExpressions Turns out there is a constraint in services such that they all need to be named the same. * Few more checker changes * Revert "Rename the rest of typeExpressions" This reverts commit f41a96b24d44a6b696d39eee9e91ef7f606bea52. * Revert "Rename typeExpression to type (for some jsdoc)" This reverts commit 7d2233a00e5c6d794c1de32c03802e8ccce1914c. * Finish undoing typeExpression rename * Rename and improve getTypeParametersForAliasSymbol Plus some other small fixes * Core checking works, but is flabbergastingly messy I'm serious. * Callback return types work now * Fix crash in services * Make github diff smaller * Try to make github diff even smaller * Fix rename for callback tag * Fix nav bar for callback tag Also clean up some now-redundant code there to find the name of typedefs. * Handle ooorder callback tags Also get rid of redundant typedef name code *in the binder*. It's everywhere! * Add ooorder callback tag test * Parse comments for typedef/callback+display param comments * Always export callbacks This requires almost no new code since it is basically the same as typedefs * Update baselines * Fix support for nested namespaced callbacks And add test * Callbacks support type parameters 1. Haven't run it with all tests 2. Haven't tested typedef tags yet 3. Still allows shared symbols when on function or class declarations. * Template tags are now bound correctly * Test oorder template tags It works. * Parser cleanup * Cleanup types and utilities As much as possible, and not as much as I would like. * Handle callback more often in services * Cleanup of binder and checker * More checker cleanup * Remove TODOs and one more cleanup * Support parameter-less callback tags * Remove extra bind call on template type parameters * Bind template tag containers Doesn't quite work with typedefs, but that's because it's now stricter, without the typedef fixes. I'm going to merge with jsdoc/callback and see how it goes. * Fix fourslash failures * Stop pre-binding js type aliases Next up, stop pre-binding js type parameters * Further cleanup of delayed js type alias binding * Stop prebinding template tags too This gets rid of prebinding entirely * Remove TODO * Fix lint * Finish merge with use-jsdoc-aliases * Update callback tag baselines * Rename getTypeParametersForAliasSymbol The real fix is *probably* to rename Type.aliasTypeArguments to aliasTypeParameters, but I want to make sure and then put it in a separate PR. --- src/compiler/binder.ts | 163 ++++++++--------- src/compiler/checker.ts | 172 +++++++++++------- src/compiler/parser.ts | 133 ++++++++++---- src/compiler/types.ts | 21 ++- src/compiler/utilities.ts | 102 +++++++---- src/services/codefixes/fixUnusedIdentifier.ts | 6 +- src/services/jsDoc.ts | 6 +- src/services/navigationBar.ts | 25 +-- src/services/refactors/extractSymbol.ts | 8 +- src/services/utilities.ts | 9 +- ...sCorrectly.typedefTagWithChildrenTags.json | 2 +- .../reference/api/tsserverlibrary.d.ts | 59 +++--- tests/baselines/reference/api/typescript.d.ts | 59 +++--- .../reference/callbackCrossModule.symbols | 32 ++++ .../reference/callbackCrossModule.types | 47 +++++ .../baselines/reference/callbackTag1.symbols | 28 +++ tests/baselines/reference/callbackTag1.types | 34 ++++ .../reference/callbackTag2.errors.txt | 42 +++++ .../baselines/reference/callbackTag2.symbols | 52 ++++++ tests/baselines/reference/callbackTag2.types | 60 ++++++ .../baselines/reference/callbackTag3.symbols | 9 + tests/baselines/reference/callbackTag3.types | 11 ++ .../reference/callbackTagNamespace.symbols | 19 ++ .../reference/callbackTagNamespace.types | 21 +++ .../reference/jsdocTemplateClass.errors.txt | 5 +- .../reference/jsdocTemplateClass.symbols | 41 +++-- .../reference/jsdocTemplateClass.types | 3 +- ...sdocTemplateConstructorFunction.errors.txt | 11 +- .../jsdocTemplateConstructorFunction.symbols | 53 +++--- .../jsdocTemplateConstructorFunction.types | 17 +- ...docTemplateConstructorFunction2.errors.txt | 2 +- .../jsdocTemplateConstructorFunction2.symbols | 2 +- .../jsdocTemplateConstructorFunction2.types | 2 +- .../reference/jsdocTemplateTag2.symbols | 19 ++ .../reference/jsdocTemplateTag2.types | 21 +++ .../conformance/jsdoc/callbackCrossModule.ts | 22 +++ tests/cases/conformance/jsdoc/callbackTag1.ts | 22 +++ tests/cases/conformance/jsdoc/callbackTag2.ts | 40 ++++ tests/cases/conformance/jsdoc/callbackTag3.ts | 10 + .../conformance/jsdoc/callbackTagNamespace.ts | 15 ++ .../conformance/jsdoc/jsdocTemplateClass.ts | 3 +- .../jsdoc/jsdocTemplateConstructorFunction.ts | 9 +- .../jsdocTemplateConstructorFunction2.ts | 2 +- .../conformance/jsdoc/jsdocTemplateTag2.ts | 16 ++ .../jsQuickInfoGenerallyAcceptableSize.ts | 6 +- .../fourslash/server/jsdocCallbackTag.ts | 54 ++++++ .../server/jsdocCallbackTagNavigateTo.ts | 33 ++++ .../server/jsdocCallbackTagRename01.ts | 15 ++ .../cases/fourslash/server/jsdocTypedefTag.ts | 9 +- 49 files changed, 1168 insertions(+), 384 deletions(-) create mode 100644 tests/baselines/reference/callbackCrossModule.symbols create mode 100644 tests/baselines/reference/callbackCrossModule.types create mode 100644 tests/baselines/reference/callbackTag1.symbols create mode 100644 tests/baselines/reference/callbackTag1.types create mode 100644 tests/baselines/reference/callbackTag2.errors.txt create mode 100644 tests/baselines/reference/callbackTag2.symbols create mode 100644 tests/baselines/reference/callbackTag2.types create mode 100644 tests/baselines/reference/callbackTag3.symbols create mode 100644 tests/baselines/reference/callbackTag3.types create mode 100644 tests/baselines/reference/callbackTagNamespace.symbols create mode 100644 tests/baselines/reference/callbackTagNamespace.types create mode 100644 tests/baselines/reference/jsdocTemplateTag2.symbols create mode 100644 tests/baselines/reference/jsdocTemplateTag2.types create mode 100644 tests/cases/conformance/jsdoc/callbackCrossModule.ts create mode 100644 tests/cases/conformance/jsdoc/callbackTag1.ts create mode 100644 tests/cases/conformance/jsdoc/callbackTag2.ts create mode 100644 tests/cases/conformance/jsdoc/callbackTag3.ts create mode 100644 tests/cases/conformance/jsdoc/callbackTagNamespace.ts create mode 100644 tests/cases/conformance/jsdoc/jsdocTemplateTag2.ts create mode 100644 tests/cases/fourslash/server/jsdocCallbackTag.ts create mode 100644 tests/cases/fourslash/server/jsdocCallbackTagNavigateTo.ts create mode 100644 tests/cases/fourslash/server/jsdocCallbackTagRename01.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index d1c782d6155..d95001b1041 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -118,7 +118,7 @@ namespace ts { let thisParentContainer: Node; // Container one level up let blockScopeContainer: Node; let lastContainer: Node; - let delayedTypedefs: { typedef: JSDocTypedefTag, container: Node, lastContainer: Node, blockScopeContainer: Node, parent: Node }[]; + let delayedTypeAliases: (JSDocTypedefTag | JSDocCallbackTag)[]; let seenThisKeyword: boolean; // state used by control flow analysis @@ -188,7 +188,7 @@ namespace ts { thisParentContainer = undefined; blockScopeContainer = undefined; lastContainer = undefined; - delayedTypedefs = undefined; + delayedTypeAliases = undefined; seenThisKeyword = false; currentFlow = undefined; currentBreakTarget = undefined; @@ -273,6 +273,7 @@ namespace ts { return InternalSymbolName.Constructor; case SyntaxKind.FunctionType: case SyntaxKind.CallSignature: + case SyntaxKind.JSDocSignature: return InternalSymbolName.Call; case SyntaxKind.ConstructorType: case SyntaxKind.ConstructSignature: @@ -301,9 +302,6 @@ namespace ts { const functionType = node.parent; const index = functionType.parameters.indexOf(node as ParameterDeclaration); return "arg" + index as __String; - case SyntaxKind.JSDocTypedefTag: - const name = getNameOfJSDocTypedef(node as JSDocTypedefTag); - return typeof name !== "undefined" ? name.escapedText : undefined; } } @@ -456,8 +454,8 @@ namespace ts { // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - if (node.kind === SyntaxKind.JSDocTypedefTag) Debug.assert(isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. - if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypedefTag(node)) { + if (isJSDocTypeAlias(node)) Debug.assert(isInJavaScriptFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. + if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypeAlias(node)) { if (hasModifier(node, ModifierFlags.Default) && !getDeclarationName(node)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } @@ -628,22 +626,6 @@ namespace ts { } function bindChildrenWorker(node: Node): void { - // Binding of JsDocComment should be done before the current block scope container changes. - // because the scope of JsDocComment should not be affected by whether the current node is a - // container or not. - if (hasJSDocNodes(node)) { - if (isInJavaScriptFile(node)) { - for (const j of node.jsDoc) { - bind(j); - } - } - else { - for (const j of node.jsDoc) { - setParentPointers(node, j); - } - } - } - if (checkUnreachable(node)) { bindEachChild(node); return; @@ -709,11 +691,9 @@ namespace ts { case SyntaxKind.CallExpression: bindCallExpressionFlow(node); break; - case SyntaxKind.JSDocComment: - bindJSDocComment(node); - break; case SyntaxKind.JSDocTypedefTag: - bindJSDocTypedefTag(node); + case SyntaxKind.JSDocCallbackTag: + bindJSDocTypeAlias(node as JSDocTypedefTag | JSDocCallbackTag); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime case SyntaxKind.SourceFile: @@ -728,6 +708,7 @@ namespace ts { bindEachChild(node); break; } + bindJSDoc(node); } function isNarrowingExpression(expr: Expression): boolean { @@ -1379,24 +1360,10 @@ namespace ts { } } - function bindJSDocComment(node: JSDoc) { - forEachChild(node, n => { - if (n.kind !== SyntaxKind.JSDocTypedefTag) { - bind(n); - } - }); - } - - function bindJSDocTypedefTag(node: JSDocTypedefTag) { - forEachChild(node, n => { - // if the node has a fullName "A.B.C", that means symbol "C" was already bound - // when we visit "fullName"; so when we visit the name "C" as the next child of - // the jsDocTypedefTag, we should skip binding it. - if (node.fullName && n === node.name && node.fullName.kind !== SyntaxKind.Identifier) { - return; - } - bind(n); - }); + function bindJSDocTypeAlias(node: JSDocTypedefTag | JSDocCallbackTag) { + if (node.fullName) { + setParentPointers(node, node.fullName); + } } function bindCallExpressionFlow(node: CallExpression) { @@ -1456,6 +1423,7 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.CallSignature: + case SyntaxKind.JSDocSignature: case SyntaxKind.JSDocFunctionType: case SyntaxKind.FunctionType: case SyntaxKind.ConstructSignature: @@ -1545,6 +1513,7 @@ namespace ts { case SyntaxKind.ConstructorType: case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: + case SyntaxKind.JSDocSignature: case SyntaxKind.IndexSignature: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: @@ -1555,6 +1524,8 @@ namespace ts { case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: case SyntaxKind.JSDocFunctionType: + case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.MappedType: // All the children of these container types are never visible through another @@ -1650,7 +1621,7 @@ namespace ts { return state; } - function bindFunctionOrConstructorType(node: SignatureDeclaration): void { + function bindFunctionOrConstructorType(node: SignatureDeclaration | JSDocSignature): void { // For a given function symbol "<...>(...) => T" we want to generate a symbol identical // to the one we would get for: { <...>(...): T } // @@ -1752,21 +1723,34 @@ namespace ts { } function delayedBindJSDocTypedefTag() { - if (!delayedTypedefs) { + if (!delayedTypeAliases) { return; } const saveContainer = container; const saveLastContainer = lastContainer; const saveBlockScopeContainer = blockScopeContainer; const saveParent = parent; - for (const delay of delayedTypedefs) { - ({ container, lastContainer, blockScopeContainer, parent } = delay); - bindBlockScopedDeclaration(delay.typedef, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes); + const saveCurrentFlow = currentFlow; + for (const typeAlias of delayedTypeAliases) { + const host = getJSDocHost(typeAlias); + container = findAncestor(host.parent, n => !!(getContainerFlags(n) & ContainerFlags.IsContainer)) || file; + blockScopeContainer = getEnclosingBlockScopeContainer(host) || file; + currentFlow = { flags: FlowFlags.Start }; + parent = typeAlias; + bind(typeAlias.typeExpression); + if (!typeAlias.fullName || typeAlias.fullName.kind === SyntaxKind.Identifier) { + parent = typeAlias.parent; + bindBlockScopedDeclaration(typeAlias, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes); + } + else { + bind(typeAlias.fullName); + } } container = saveContainer; lastContainer = saveLastContainer; blockScopeContainer = saveBlockScopeContainer; parent = saveParent; + currentFlow = saveCurrentFlow; } // The binder visits every node in the syntax tree so it is a convenient place to perform a single localized @@ -1946,7 +1930,6 @@ namespace ts { // Here the current node is "foo", which is a container, but the scope of "MyType" should // not be inside "foo". Therefore we always bind @typedef before bind the parent node, // and skip binding this tag later when binding all the other jsdoc tags. - if (isInJavaScriptFile(node)) bindJSDocTypedefTagIfAny(node); // First we bind declaration nodes to a symbol if possible. We'll both create a symbol // and then potentially add the symbol to an appropriate symbol table. Possible @@ -1978,26 +1961,21 @@ namespace ts { } else if (!skipTransformFlagAggregation && (node.transformFlags & TransformFlags.HasComputedFlags) === 0) { subtreeTransformFlags |= computeTransformFlagsForNode(node, 0); + bindJSDoc(node); } inStrictMode = saveInStrictMode; } - function bindJSDocTypedefTagIfAny(node: Node) { - if (!hasJSDocNodes(node)) { - return; - } - - for (const jsDoc of node.jsDoc) { - if (!jsDoc.tags) { - continue; + function bindJSDoc(node: Node) { + if (hasJSDocNodes(node)) { + if (isInJavaScriptFile(node)) { + for (const j of node.jsDoc) { + bind(j); + } } - - for (const tag of jsDoc.tags) { - if (tag.kind === SyntaxKind.JSDocTypedefTag) { - const savedParent = parent; - parent = jsDoc; - bind(tag); - parent = savedParent; + else { + for (const j of node.jsDoc) { + setParentPointers(node, j); } } } @@ -2036,10 +2014,10 @@ namespace ts { // current "blockScopeContainer" needs to be set to its immediate namespace parent. if ((node).isInJSDocNamespace) { let parentNode = node.parent; - while (parentNode && parentNode.kind !== SyntaxKind.JSDocTypedefTag) { + while (parentNode && !isJSDocTypeAlias(parentNode)) { parentNode = parentNode.parent; } - bindBlockScopedDeclaration(parentNode, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes); + bindBlockScopedDeclaration(parentNode as Declaration, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes); break; } // falls through @@ -2141,8 +2119,9 @@ namespace ts { return bindPropertyOrMethodOrAccessor(node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes); case SyntaxKind.FunctionType: case SyntaxKind.JSDocFunctionType: + case SyntaxKind.JSDocSignature: case SyntaxKind.ConstructorType: - return bindFunctionOrConstructorType(node); + return bindFunctionOrConstructorType(node); case SyntaxKind.TypeLiteral: case SyntaxKind.JSDocTypeLiteral: case SyntaxKind.MappedType: @@ -2205,6 +2184,9 @@ namespace ts { return updateStrictModeStatementList((node).statements); case SyntaxKind.JSDocParameterTag: + if (node.parent.kind === SyntaxKind.JSDocSignature) { + return bindParameter(node as JSDocParameterTag); + } if (node.parent.kind !== SyntaxKind.JSDocTypeLiteral) { break; } @@ -2215,13 +2197,9 @@ namespace ts { SymbolFlags.Property | SymbolFlags.Optional : SymbolFlags.Property; return declareSymbolAndAddToSymbolTable(propTag, flags, SymbolFlags.PropertyExcludes); - case SyntaxKind.JSDocTypedefTag: { - const { fullName } = node as JSDocTypedefTag; - if (!fullName || fullName.kind === SyntaxKind.Identifier) { - (delayedTypedefs || (delayedTypedefs = [])).push({ typedef: node as JSDocTypedefTag, container, lastContainer, blockScopeContainer, parent }); - } - break; - } + case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: + return (delayedTypeAliases || (delayedTypeAliases = [])).push(node as JSDocTypedefTag | JSDocCallbackTag); } } @@ -2622,7 +2600,10 @@ namespace ts { } } - function bindParameter(node: ParameterDeclaration) { + function bindParameter(node: ParameterDeclaration | JSDocParameterTag) { + if (node.kind === SyntaxKind.JSDocParameterTag && container.kind !== SyntaxKind.JSDocSignature) { + return; + } if (inStrictMode && !(node.flags & NodeFlags.Ambient)) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -2630,7 +2611,7 @@ namespace ts { } if (isBindingPattern(node.name)) { - bindAnonymousDeclaration(node, SymbolFlags.FunctionScopedVariable, "__" + node.parent.parameters.indexOf(node) as __String); + bindAnonymousDeclaration(node, SymbolFlags.FunctionScopedVariable, "__" + (node as ParameterDeclaration).parent.parameters.indexOf(node as ParameterDeclaration) as __String); } else { declareSymbolAndAddToSymbolTable(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes); @@ -2690,18 +2671,24 @@ namespace ts { } function getInferTypeContainer(node: Node): ConditionalTypeNode { - while (node) { - const parent = node.parent; - if (parent && parent.kind === SyntaxKind.ConditionalType && (parent).extendsType === node) { - return parent; - } - node = parent; - } - return undefined; + const extendsType = findAncestor(node, n => n.parent && isConditionalTypeNode(n.parent) && n.parent.extendsType === n); + return extendsType && extendsType.parent as ConditionalTypeNode; } function bindTypeParameter(node: TypeParameterDeclaration) { - if (node.parent.kind === SyntaxKind.InferType) { + if (isJSDocTemplateTag(node.parent)) { + const container = find((node.parent.parent as JSDoc).tags, isJSDocTypeAlias) || getHostSignatureFromJSDoc(node.parent); + if (container) { + if (!container.locals) { + container.locals = createSymbolTable(); + } + declareSymbol(container.locals, /*parent*/ undefined, node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes); + } + else { + declareSymbolAndAddToSymbolTable(node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes); + } + } + else if (node.parent.kind === SyntaxKind.InferType) { const container = getInferTypeContainer(node.parent); if (container) { if (!container.locals) { @@ -3804,6 +3791,6 @@ namespace ts { */ function setParentPointers(parent: Node, child: Node): void { child.parent = parent; - forEachChild(child, (childsChild) => setParentPointers(child, childsChild)); + forEachChild(child, grandchild => setParentPointers(child, grandchild)); } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d0780406f11..4c9a98951fa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1577,9 +1577,11 @@ namespace ts { function isTypeParameterSymbolDeclaredInContainer(symbol: Symbol, container: Node) { for (const decl of symbol.declarations) { - const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent; - if (decl.kind === SyntaxKind.TypeParameter && parent === container) { - return true; + if (decl.kind === SyntaxKind.TypeParameter) { + const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent; + if (parent === container) { + return !(isJSDocTemplateTag(decl.parent) && find((decl.parent.parent as JSDoc).tags, isJSDocTypeAlias)); + } } } @@ -2089,7 +2091,7 @@ namespace ts { let symbol: Symbol; if (name.kind === SyntaxKind.Identifier) { const message = meaning === namespaceMeaning ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0; - const symbolFromJSPrototype = isInJavaScriptFile(name) ? resolveEntityNameFromJSPrototype(name, meaning) : undefined; + const symbolFromJSPrototype = isInJavaScriptFile(name) ? resolveEntityNameFromJSSpecialAssignment(name, meaning) : undefined; symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true); if (!symbol) { return symbolFromJSPrototype; @@ -2144,25 +2146,34 @@ namespace ts { } /** - * For prototype-property methods like `A.prototype.m = function () ...`, try to resolve names in the scope of `A` too. + * 1. For prototype-property methods like `A.prototype.m = function () ...`, try to resolve names in the scope of `A` too. * Note that prototype-property assignment to locations outside the current file (eg globals) doesn't work, so * name resolution won't work either. + * 2. For property assignments like `{ x: function f () { } }`, try to resolve names in the scope of `f` too. */ - function resolveEntityNameFromJSPrototype(name: Identifier, meaning: SymbolFlags) { - if (isJSDocTypeReference(name.parent) && isJSDocTag(name.parent.parent.parent)) { - const host = getJSDocHost(name.parent.parent.parent as JSDocTag); - if (isExpressionStatement(host) && - isBinaryExpression(host.expression) && - getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) { - const symbol = getSymbolOfNode(host.expression.left); - if (symbol) { - const secondaryLocation = symbol.parent.valueDeclaration; - return resolveName(secondaryLocation, name.escapedText, meaning, /*nameNotFoundMessage*/ undefined, name, /*isUse*/ true); - } + function resolveEntityNameFromJSSpecialAssignment(name: Identifier, meaning: SymbolFlags) { + if (isJSDocTypeReference(name.parent)) { + const host = getJSDocHost(name.parent); + if (host) { + const secondaryLocation = getJSSpecialAssignmentSymbol(getJSDocHost(name.parent.parent.parent as JSDocTag)); + return secondaryLocation && resolveName(secondaryLocation, name.escapedText, meaning, /*nameNotFoundMessage*/ undefined, name, /*isUse*/ true); } } } + function getJSSpecialAssignmentSymbol(host: HasJSDoc): Declaration | undefined { + if (isPropertyAssignment(host) && isFunctionLike(host.initializer)) { + const symbol = getSymbolOfNode(host.initializer); + return symbol && symbol.valueDeclaration; + } + else if (isExpressionStatement(host) && + isBinaryExpression(host.expression) && + getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) { + const symbol = getSymbolOfNode(host.expression.left); + return symbol && symbol.parent.valueDeclaration; + } + } + function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol { return resolveExternalModuleNameWorker(location, moduleReferenceExpression, Diagnostics.Cannot_find_module_0); } @@ -3606,8 +3617,10 @@ namespace ts { } function symbolToParameterDeclaration(parameterSymbol: Symbol, context: NodeBuilderContext, preserveModifierFlags?: boolean): ParameterDeclaration { - const parameterDeclaration = getDeclarationOfKind(parameterSymbol, SyntaxKind.Parameter); - Debug.assert(!!parameterDeclaration || isTransientSymbol(parameterSymbol)); + let parameterDeclaration: ParameterDeclaration | JSDocParameterTag = getDeclarationOfKind(parameterSymbol, SyntaxKind.Parameter); + if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) { + parameterDeclaration = getDeclarationOfKind(parameterSymbol, SyntaxKind.JSDocParameterTag); + } let parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -3620,8 +3633,8 @@ namespace ts { const dotDotDotToken = isRest ? createToken(SyntaxKind.DotDotDotToken) : undefined; const name = parameterDeclaration ? parameterDeclaration.name ? - parameterDeclaration.name.kind === SyntaxKind.Identifier ? - setEmitFlags(getSynthesizedClone(parameterDeclaration.name), EmitFlags.NoAsciiEscaping) : + parameterDeclaration.name.kind === SyntaxKind.Identifier ? setEmitFlags(getSynthesizedClone(parameterDeclaration.name), EmitFlags.NoAsciiEscaping) : + parameterDeclaration.name.kind === SyntaxKind.QualifiedName ? setEmitFlags(getSynthesizedClone(parameterDeclaration.name.right), EmitFlags.NoAsciiEscaping) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol); @@ -4026,8 +4039,9 @@ namespace ts { function determineIfDeclarationIsVisible() { switch (node.kind) { + case SyntaxKind.JSDocCallbackTag: case SyntaxKind.JSDocTypedefTag: - // Top-level jsdoc typedefs are considered exported + // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && isSourceFile(node.parent.parent.parent)); case SyntaxKind.BindingElement: @@ -4802,7 +4816,7 @@ namespace ts { if (symbol.flags & SymbolFlags.Prototype) { return links.type = getTypeOfPrototypeProperty(symbol); } - // CommonsJS require/module/exports all have type any. + // CommonsJS require and module both have type any. if (symbol === requireSymbol || symbol === moduleSymbol) { return links.type = anyType; } @@ -4837,7 +4851,7 @@ namespace ts { declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) { type = getWidenedTypeFromJSSpecialPropertyDeclarations(symbol); } - else if (isJSDocPropertyTag(declaration) + else if (isJSDocPropertyLikeTag(declaration) || isPropertyAccessExpression(declaration) || isIdentifier(declaration) || (isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration)) @@ -5139,6 +5153,8 @@ namespace ts { case SyntaxKind.ArrowFunction: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.JSDocTemplateTag: + case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: case SyntaxKind.MappedType: case SyntaxKind.ConditionalType: const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); @@ -5168,9 +5184,11 @@ namespace ts { function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol: Symbol): TypeParameter[] { let result: TypeParameter[]; for (const node of symbol.declarations) { - if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.ClassDeclaration || - node.kind === SyntaxKind.ClassExpression || node.kind === SyntaxKind.TypeAliasDeclaration || node.kind === SyntaxKind.JSDocTypedefTag) { - const declaration = node; + if (node.kind === SyntaxKind.InterfaceDeclaration || + node.kind === SyntaxKind.ClassDeclaration || + node.kind === SyntaxKind.ClassExpression || + isTypeAlias(node)) { + const declaration = node; const typeParameters = getEffectiveTypeParameterDeclarations(declaration); if (typeParameters) { result = appendTypeParameters(result, typeParameters); @@ -5466,9 +5484,9 @@ namespace ts { return unknownType; } - const declaration = find(symbol.declarations, d => - d.kind === SyntaxKind.JSDocTypedefTag || d.kind === SyntaxKind.TypeAliasDeclaration); - const typeNode = declaration.kind === SyntaxKind.JSDocTypedefTag ? declaration.typeExpression : declaration.type; + const declaration = find(symbol.declarations, d => + isJSDocTypeAlias(d) || d.kind === SyntaxKind.TypeAliasDeclaration); + const typeNode = isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type; // If typeNode is missing, we will error in checkJSDocTypedefTag. let type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType; @@ -6036,7 +6054,7 @@ namespace ts { } function createSignature( - declaration: SignatureDeclaration, + declaration: SignatureDeclaration | JSDocSignature, typeParameters: TypeParameter[], thisParameter: Symbol | undefined, parameters: Symbol[], @@ -7046,8 +7064,8 @@ namespace ts { return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol; } - function isOptionalParameter(node: ParameterDeclaration) { - if (hasQuestionToken(node) || isJSDocOptionalParameter(node)) { + function isOptionalParameter(node: ParameterDeclaration | JSDocParameterTag) { + if (hasQuestionToken(node) || isOptionalJSDocParameterTag(node) || isJSDocOptionalParameter(node)) { return true; } @@ -7067,6 +7085,14 @@ namespace ts { return false; } + function isOptionalJSDocParameterTag(node: Node): node is JSDocParameterTag { + if (!isJSDocParameterTag(node)) { + return false; + } + const { isBracketed, typeExpression } = node; + return isBracketed || !!typeExpression && typeExpression.type.kind === SyntaxKind.JSDocOptionalType; + } + function createTypePredicateFromTypePredicateNode(node: TypePredicateNode): IdentifierTypePredicate | ThisTypePredicate { const { parameterName } = node; const type = getTypeFromTypeNode(node.type); @@ -7142,7 +7168,7 @@ namespace ts { return typeArguments; } - function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { + function getSignatureFromDeclaration(declaration: SignatureDeclaration | JSDocSignature): Signature { const links = getNodeLinks(declaration); if (!links.resolvedSignature) { const parameters: Symbol[] = []; @@ -7165,6 +7191,7 @@ namespace ts { const param = declaration.parameters[i]; let paramSymbol = param.symbol; + const type = isJSDocParameterTag(param) ? (param.typeExpression && param.typeExpression.type) : param.type; // Include parameter symbol instead of property symbol in the signature if (paramSymbol && !!(paramSymbol.flags & SymbolFlags.Property) && !isBindingPattern(param.name)) { const resolvedSymbol = resolveName(param, paramSymbol.escapedName, SymbolFlags.Value, undefined, undefined, /*isUse*/ false); @@ -7178,13 +7205,14 @@ namespace ts { parameters.push(paramSymbol); } - if (param.type && param.type.kind === SyntaxKind.LiteralType) { + if (type && type.kind === SyntaxKind.LiteralType) { hasLiteralTypes = true; } // Record a new minimum argument count if this is not an optional parameter - const isOptionalParameter = param.initializer || param.questionToken || param.dotDotDotToken || - iife && parameters.length > iife.arguments.length && !param.type || + const isOptionalParameter = isOptionalJSDocParameterTag(param) || + param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !type || isUntypedSignatureInJSFile || isJSDocOptionalParameter(param); if (!isOptionalParameter) { @@ -7220,8 +7248,8 @@ namespace ts { * OR * 2. It has at least one parameter, and the last parameter has a matching `@param` with a type that starts with `...` */ - function maybeAddJsSyntheticRestParameter(declaration: SignatureDeclaration, parameters: Symbol[]): boolean { - if (!containsArgumentsReference(declaration)) { + function maybeAddJsSyntheticRestParameter(declaration: SignatureDeclaration | JSDocSignature, parameters: Symbol[]): boolean { + if (isJSDocSignature(declaration) || !containsArgumentsReference(declaration)) { return false; } const lastParam = lastOrUndefined(declaration.parameters); @@ -7240,9 +7268,9 @@ namespace ts { return true; } - function getSignatureReturnTypeFromDeclaration(declaration: SignatureDeclaration, isJSConstructSignature: boolean, classType: Type) { + function getSignatureReturnTypeFromDeclaration(declaration: SignatureDeclaration | JSDocSignature, isJSConstructSignature: boolean, classType: Type) { if (isJSConstructSignature) { - return getTypeFromTypeNode(declaration.parameters[0].type); + return getTypeFromTypeNode((declaration.parameters[0] as ParameterDeclaration).type); } else if (classType) { return classType; @@ -7656,11 +7684,11 @@ namespace ts { const missingAugmentsTag = isJs && node.parent.kind !== SyntaxKind.JSDocAugmentsTag; const diag = minTypeArgumentCount === typeParameters.length ? missingAugmentsTag - ? Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag - : Diagnostics.Generic_type_0_requires_1_type_argument_s - : missingAugmentsTag - ? Diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag - : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments; + ? Diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag + : Diagnostics.Generic_type_0_requires_1_type_argument_s + : missingAugmentsTag + ? Diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag + : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments; const typeStr = typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType); error(node, diag, typeStr, minTypeArgumentCount, typeParameters.length); if (!isJs) { @@ -7675,7 +7703,7 @@ namespace ts { return createTypeReference(type, typeArguments); } return checkNoTypeArguments(node, symbol) ? type : unknownType; - } + } function getTypeAliasInstantiation(symbol: Symbol, typeArguments: Type[]): Type { const type = getDeclaredTypeOfSymbol(symbol); @@ -7702,18 +7730,18 @@ namespace ts { const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) { error(node, - minTypeArgumentCount === typeParameters.length - ? Diagnostics.Generic_type_0_requires_1_type_argument_s - : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, - symbolToString(symbol), - minTypeArgumentCount, - typeParameters.length); + minTypeArgumentCount === typeParameters.length + ? Diagnostics.Generic_type_0_requires_1_type_argument_s + : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments, + symbolToString(symbol), + minTypeArgumentCount, + typeParameters.length); return unknownType; } return getTypeAliasInstantiation(symbol, typeArguments); } return checkNoTypeArguments(node, symbol) ? type : unknownType; - } + } function getTypeReferenceName(node: TypeReferenceType): EntityNameOrEntityNameExpression | undefined { switch (node.kind) { @@ -7828,7 +7856,7 @@ namespace ts { function getConstrainedTypeVariable(typeVariable: TypeVariable, node: Node) { let constraints: Type[]; - while (node && !isStatement(node)) { + while (node && !isStatement(node) && node.kind !== SyntaxKind.JSDocComment) { const parent = node.parent; if (parent.kind === SyntaxKind.ConditionalType && node === (parent).trueType) { const constraint = getImpliedConstraint(typeVariable, (parent).checkType, (parent).extendsType); @@ -8396,8 +8424,9 @@ namespace ts { function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { const links = getNodeLinks(node); if (!links.resolvedType) { + const aliasSymbol = getAliasSymbolForTypeNode(node); links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), UnionReduction.Literal, - getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node)); + aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)); } return links.resolvedType; } @@ -8506,8 +8535,9 @@ namespace ts { function getTypeFromIntersectionTypeNode(node: IntersectionTypeNode): Type { const links = getNodeLinks(node); if (!links.resolvedType) { + const aliasSymbol = getAliasSymbolForTypeNode(node); links.resolvedType = getIntersectionType(map(node.types, getTypeFromTypeNode), - getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node)); + aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)); } return links.resolvedType; } @@ -8816,7 +8846,7 @@ namespace ts { const type = createObjectType(ObjectFlags.Mapped, node.symbol); type.declaration = node; type.aliasSymbol = getAliasSymbolForTypeNode(node); - type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); + type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(type.aliasSymbol); links.resolvedType = type; // Eagerly resolve the constraint type which forces an error if the constraint type circularly // references itself through one or more type aliases. @@ -8924,7 +8954,8 @@ namespace ts { const links = getNodeLinks(node); if (!links.resolvedType) { const checkType = getTypeFromTypeNode(node.checkType); - const aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); + const aliasSymbol = getAliasSymbolForTypeNode(node); + const aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); const allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true); const outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : filter(allOuterTypeParameters, tp => isPossiblyReferencedInConditionalType(tp, node)); const root: ConditionalRoot = { @@ -8937,7 +8968,7 @@ namespace ts { inferTypeParameters: getInferTypeParameters(node), outerTypeParameters, instantiations: undefined, - aliasSymbol: getAliasSymbolForTypeNode(node), + aliasSymbol, aliasTypeArguments }; links.resolvedType = getConditionalType(root, /*mapper*/ undefined); @@ -9041,7 +9072,7 @@ namespace ts { else { let type = createObjectType(ObjectFlags.Anonymous, node.symbol); type.aliasSymbol = aliasSymbol; - type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); + type.aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol); if (isJSDocTypeLiteral(node) && node.isArrayType) { type = createArrayType(type); } @@ -9052,11 +9083,10 @@ namespace ts { } function getAliasSymbolForTypeNode(node: TypeNode) { - return (node.parent.kind === SyntaxKind.TypeAliasDeclaration || node.parent.kind === SyntaxKind.JSDocTypedefTag) ? getSymbolOfNode(node.parent) : undefined; + return isTypeAlias(node.parent) ? getSymbolOfNode(node.parent) : undefined; } - function getAliasTypeArgumentsForTypeNode(node: TypeNode) { - const symbol = getAliasSymbolForTypeNode(node); + function getTypeArgumentsForAliasSymbol(symbol: Symbol) { return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } @@ -9314,6 +9344,7 @@ namespace ts { case SyntaxKind.TypeLiteral: case SyntaxKind.JSDocTypeLiteral: case SyntaxKind.JSDocFunctionType: + case SyntaxKind.JSDocSignature: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case SyntaxKind.TypeOperator: return getTypeFromTypeOperatorNode(node); @@ -9991,8 +10022,8 @@ namespace ts { function compareTypePredicateRelatedTo( source: TypePredicate, target: TypePredicate, - sourceDeclaration: SignatureDeclaration, - targetDeclaration: SignatureDeclaration, + sourceDeclaration: SignatureDeclaration | JSDocSignature, + targetDeclaration: SignatureDeclaration | JSDocSignature, reportErrors: boolean, errorReporter: ErrorReporter, compareTypes: (s: Type, t: Type, reportErrors?: boolean) => Ternary): Ternary { @@ -21761,8 +21792,9 @@ namespace ts { switch (d.kind) { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.TypeAliasDeclaration: - // A jsdoc typedef is, by definition, a type alias + // A jsdoc typedef and callback are, by definition, type aliases case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: return DeclarationSpaces.ExportType; case SyntaxKind.ModuleDeclaration: return isAmbientModule(d as ModuleDeclaration) || getModuleInstanceState(d as ModuleDeclaration) !== ModuleInstanceState.NonInstantiated @@ -22297,7 +22329,7 @@ namespace ts { } } - function checkJSDocTypedefTag(node: JSDocTypedefTag) { + function checkJSDocTypeAliasTag(node: JSDocTypedefTag | JSDocCallbackTag) { if (!node.typeExpression) { // If the node had `@property` tags, `typeExpression` would have been set to the first property tag. error(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags); @@ -25212,7 +25244,8 @@ namespace ts { case SyntaxKind.JSDocAugmentsTag: return checkJSDocAugmentsTag(node as JSDocAugmentsTag); case SyntaxKind.JSDocTypedefTag: - return checkJSDocTypedefTag(node as JSDocTypedefTag); + case SyntaxKind.JSDocCallbackTag: + return checkJSDocTypeAliasTag(node as JSDocTypedefTag); case SyntaxKind.JSDocParameterTag: return checkJSDocParameterTag(node as JSDocParameterTag); case SyntaxKind.JSDocFunctionType: @@ -26423,9 +26456,10 @@ namespace ts { return false; } - function isRequiredInitializedParameter(parameter: ParameterDeclaration) { + function isRequiredInitializedParameter(parameter: ParameterDeclaration | JSDocParameterTag) { return strictNullChecks && !isOptionalParameter(parameter) && + !isJSDocParameterTag(parameter) && parameter.initializer && !hasModifier(parameter, ModifierFlags.ParameterPropertyModifier); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index bbd4edc8507..0b9a0142496 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -489,6 +489,15 @@ namespace ts { return visitNode(cbNode, (node).fullName) || visitNode(cbNode, (node).typeExpression); } + case SyntaxKind.JSDocCallbackTag: + return visitNode(cbNode, (node as JSDocCallbackTag).fullName) || + visitNode(cbNode, (node as JSDocCallbackTag).typeExpression); + case SyntaxKind.JSDocSignature: + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, (node).typeParameters) || + visitNodes(cbNode, cbNodes, (node).parameters) || + visitNode(cbNode, (node).type); case SyntaxKind.JSDocTypeLiteral: if ((node as JSDocTypeLiteral).jsDocPropertyTags) { for (const tag of (node as JSDocTypeLiteral).jsDocPropertyTags) { @@ -6331,8 +6340,9 @@ namespace ts { } const enum PropertyLikeParse { - Property, - Parameter, + Property = 1 << 0, + Parameter = 1 << 1, + CallbackParameter = 1 << 2, } export function parseJSDocCommentWorker(start: number, length: number): JSDoc { @@ -6386,7 +6396,7 @@ namespace ts { case SyntaxKind.AtToken: if (state === JSDocState.BeginningOfLine || state === JSDocState.SawAsterisk) { removeTrailingNewlines(comments); - parseTag(indent); + addTag(parseTag(indent)); // NOTE: According to usejsdoc.org, a tag goes to end of line, except the last tag. // Real-world comments may break this rule, so "BeginningOfLine" will not be a real line beginning // for malformed examples like `/** @param {string} x @returns {number} the length */` @@ -6503,8 +6513,7 @@ namespace ts { case "arg": case "argument": case "param": - addTag(parseParameterOrPropertyTag(atToken, tagName, PropertyLikeParse.Parameter, indent)); - return; + return parseParameterOrPropertyTag(atToken, tagName, PropertyLikeParse.Parameter, indent); case "return": case "returns": tag = parseReturnTag(atToken, tagName); @@ -6516,7 +6525,10 @@ namespace ts { tag = parseTypeTag(atToken, tagName); break; case "typedef": - tag = parseTypedefTag(atToken, tagName); + tag = parseTypedefTag(atToken, tagName, indent); + break; + case "callback": + tag = parseCallbackTag(atToken, tagName, indent); break; default: tag = parseUnknownTag(atToken, tagName); @@ -6531,8 +6543,11 @@ namespace ts { // a badly malformed tag should not be added to the list of tags return; } - tag.comment = parseTagComments(indent + tag.end - tag.pos); - addTag(tag); + if (!tag.comment) { + // some tags, like typedef and callback, have already parsed their comments earlier + tag.comment = parseTagComments(indent + tag.end - tag.pos); + } + return tag; } function parseTagComments(indent: number): string | undefined { @@ -6605,6 +6620,9 @@ namespace ts { } function addTag(tag: JSDocTag): void { + if (!tag) { + return; + } if (!tags) { tags = [tag]; tagsPos = tag.pos; @@ -6665,9 +6683,9 @@ namespace ts { typeExpression = tryParseTypeExpression(); } - const result = target === PropertyLikeParse.Parameter ? - createNode(SyntaxKind.JSDocParameterTag, atToken.pos) : - createNode(SyntaxKind.JSDocPropertyTag, atToken.pos); + const result = target === PropertyLikeParse.Property ? + createNode(SyntaxKind.JSDocPropertyTag, atToken.pos) : + createNode(SyntaxKind.JSDocParameterTag, atToken.pos); let comment: string | undefined; if (indent !== undefined) comment = parseTagComments(indent + scanner.getStartPos() - atToken.pos); const nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name, target); @@ -6771,27 +6789,17 @@ namespace ts { return finishNode(tag); } - function parseTypedefTag(atToken: AtToken, tagName: Identifier): JSDocTypedefTag { + function parseTypedefTag(atToken: AtToken, tagName: Identifier, indent: number): JSDocTypedefTag { const typeExpression = tryParseTypeExpression(); skipWhitespace(); const typedefTag = createNode(SyntaxKind.JSDocTypedefTag, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; - typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); - if (typedefTag.fullName) { - let rightNode = typedefTag.fullName; - while (true) { - if (rightNode.kind === SyntaxKind.Identifier || !rightNode.body) { - // if node is identifier - use it as name - // otherwise use name of the rightmost part that we were able to parse - typedefTag.name = rightNode.kind === SyntaxKind.Identifier ? rightNode : rightNode.name; - break; - } - rightNode = rightNode.body; - } - } + typedefTag.fullName = parseJSDocTypeNameWithNamespace(); + typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName); skipWhitespace(); + typedefTag.comment = parseTagComments(indent); typedefTag.typeExpression = typeExpression; if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) { @@ -6826,23 +6834,69 @@ namespace ts { } return finishNode(typedefTag); + } - function parseJSDocTypeNameWithNamespace(flags: NodeFlags) { - const pos = scanner.getTokenPos(); - const typeNameOrNamespaceName = parseJSDocIdentifierName(); + function parseJSDocTypeNameWithNamespace(nested?: boolean) { + const pos = scanner.getTokenPos(); + const typeNameOrNamespaceName = parseJSDocIdentifierName(); - if (typeNameOrNamespaceName && parseOptional(SyntaxKind.DotToken)) { - const jsDocNamespaceNode = createNode(SyntaxKind.ModuleDeclaration, pos); - jsDocNamespaceNode.flags |= flags; - jsDocNamespaceNode.name = typeNameOrNamespaceName; - jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(NodeFlags.NestedNamespace); - return finishNode(jsDocNamespaceNode); + if (typeNameOrNamespaceName && parseOptional(SyntaxKind.DotToken)) { + const jsDocNamespaceNode = createNode(SyntaxKind.ModuleDeclaration, pos); + if (nested) { + jsDocNamespaceNode.flags |= NodeFlags.NestedNamespace; } + jsDocNamespaceNode.name = typeNameOrNamespaceName; + jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(/*nested*/ true); + return finishNode(jsDocNamespaceNode); + } - if (typeNameOrNamespaceName && flags & NodeFlags.NestedNamespace) { - typeNameOrNamespaceName.isInJSDocNamespace = true; + if (typeNameOrNamespaceName && nested) { + typeNameOrNamespaceName.isInJSDocNamespace = true; + } + return typeNameOrNamespaceName; + } + + function parseCallbackTag(atToken: AtToken, tagName: Identifier, indent: number): JSDocCallbackTag { + const callbackTag = createNode(SyntaxKind.JSDocCallbackTag, atToken.pos) as JSDocCallbackTag; + callbackTag.atToken = atToken; + callbackTag.tagName = tagName; + callbackTag.fullName = parseJSDocTypeNameWithNamespace(); + callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName); + skipWhitespace(); + callbackTag.comment = parseTagComments(indent); + + let child: JSDocParameterTag | false; + const start = scanner.getStartPos(); + const jsdocSignature = createNode(SyntaxKind.JSDocSignature, start) as JSDocSignature; + jsdocSignature.parameters = []; + while (child = tryParse(() => parseChildParameterOrPropertyTag(PropertyLikeParse.CallbackParameter) as JSDocParameterTag)) { + jsdocSignature.parameters = append(jsdocSignature.parameters as MutableNodeArray, child); + } + const returnTag = tryParse(() => { + if (token() === SyntaxKind.AtToken) { + nextJSDocToken(); + const tag = parseTag(indent); + if (tag && tag.kind === SyntaxKind.JSDocReturnTag) { + return tag as JSDocReturnTag; + } + } + }); + if (returnTag) { + jsdocSignature.type = returnTag; + } + callbackTag.typeExpression = finishNode(jsdocSignature); + return finishNode(callbackTag); + } + + function getJSDocTypeAliasName(fullName: JSDocNamespaceBody | undefined) { + if (fullName) { + let rightNode = fullName; + while (true) { + if (ts.isIdentifier(rightNode) || !rightNode.body) { + return ts.isIdentifier(rightNode) ? rightNode : rightNode.name; + } + rightNode = rightNode.body; } - return typeNameOrNamespaceName; } } @@ -6872,6 +6926,7 @@ namespace ts { if (canParseTag) { const child = tryParseChildTag(target); if (child && child.kind === SyntaxKind.JSDocParameterTag && + target !== PropertyLikeParse.CallbackParameter && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } @@ -6920,12 +6975,12 @@ namespace ts { case "arg": case "argument": case "param": - t = PropertyLikeParse.Parameter; + t = PropertyLikeParse.Parameter | PropertyLikeParse.CallbackParameter; break; default: return false; } - if (target !== t) { + if (!(target & t)) { return false; } const tag = parseParameterOrPropertyTag(atToken, tagName, target, /*indent*/ undefined); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f2a6f001a21..7892b11eaea 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -413,9 +413,11 @@ namespace ts { JSDocVariadicType, JSDocComment, JSDocTypeLiteral, + JSDocSignature, JSDocTag, JSDocAugmentsTag, JSDocClassTag, + JSDocCallbackTag, JSDocParameterTag, JSDocReturnTag, JSDocTypeTag, @@ -2053,7 +2055,7 @@ namespace ts { export type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode; - export type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag; + export type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature; export interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer { kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression; @@ -2387,6 +2389,21 @@ namespace ts { typeExpression?: JSDocTypeExpression | JSDocTypeLiteral; } + export interface JSDocCallbackTag extends JSDocTag, NamedDeclaration { + parent: JSDoc; + kind: SyntaxKind.JSDocCallbackTag; + fullName?: JSDocNamespaceDeclaration | Identifier; + name?: Identifier; + typeExpression: JSDocSignature; + } + + export interface JSDocSignature extends JSDocType, Declaration { + kind: SyntaxKind.JSDocSignature; + typeParameters?: ReadonlyArray; + parameters: ReadonlyArray; + type: JSDocReturnTag | undefined; + } + export interface JSDocPropertyLikeTag extends JSDocTag, Declaration { parent: JSDoc; name: EntityName; @@ -4032,7 +4049,7 @@ namespace ts { } export interface Signature { - declaration?: SignatureDeclaration; // Originating declaration + declaration?: SignatureDeclaration | JSDocSignature; // Originating declaration typeParameters?: TypeParameter[]; // Type parameters (undefined if non-generic) parameters: Symbol[]; // Parameters /* @internal */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e10d40a70ba..7339907547a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -520,6 +520,9 @@ namespace ts { case SyntaxKind.SetAccessor: case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: + case SyntaxKind.JSDocCallbackTag: + case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocSignature: return true; default: assertTypeIsNever(node); @@ -561,14 +564,7 @@ namespace ts { // Gets the nearest enclosing block scope container that has the provided node // as a descendant, that is not the provided node. export function getEnclosingBlockScopeContainer(node: Node): Node { - let current = node.parent; - while (current) { - if (isBlockScope(current, current.parent)) { - return current; - } - - current = current.parent; - } + return findAncestor(node.parent, current => isBlockScope(current, current.parent)); } // Return display name of an identifier @@ -1803,6 +1799,14 @@ namespace ts { ((node as JSDocFunctionType).parameters[0].name as Identifier).escapedText === "new"; } + export function isJSDocTypeAlias(node: Node): node is JSDocTypedefTag | JSDocCallbackTag { + return node.kind === SyntaxKind.JSDocTypedefTag || node.kind === SyntaxKind.JSDocCallbackTag; + } + + export function isTypeAlias(node: Node): node is JSDocTypedefTag | JSDocCallbackTag | TypeAliasDeclaration { + return isJSDocTypeAlias(node) || isTypeAliasDeclaration(node); + } + function getSourceOfAssignment(node: Node): Node { return isExpressionStatement(node) && node.expression && isBinaryExpression(node.expression) && @@ -1826,6 +1830,8 @@ namespace ts { return v && v.initializer; case SyntaxKind.PropertyDeclaration: return (node as PropertyDeclaration).initializer; + case SyntaxKind.PropertyAssignment: + return (node as PropertyAssignment).initializer; } } @@ -1907,7 +1913,7 @@ namespace ts { return parameter && parameter.symbol; } - export function getHostSignatureFromJSDoc(node: JSDocParameterTag): SignatureDeclaration | undefined { + export function getHostSignatureFromJSDoc(node: JSDocTag): SignatureDeclaration | undefined { const host = getJSDocHost(node); const decl = getSourceOfDefaultedAssignment(host) || getSourceOfAssignment(host) || @@ -1918,18 +1924,12 @@ namespace ts { return decl && isFunctionLike(decl) ? decl : undefined; } - export function getJSDocHost(node: JSDocTag): HasJSDoc { - while (node.parent.kind === SyntaxKind.JSDocTypeLiteral) { - if (node.parent.parent.kind === SyntaxKind.JSDocTypedefTag) { - node = node.parent.parent as JSDocTypedefTag; - } - else { - // node.parent.parent is a type expression, child of a parameter type - node = node.parent.parent.parent as JSDocParameterTag; - } + export function getJSDocHost(node: Node): HasJSDoc { + const comment = findAncestor(node.parent, + node => !(isJSDocNode(node) || node.flags & NodeFlags.JSDoc) ? "quit" : node.kind === SyntaxKind.JSDocComment); + if (comment) { + return (comment as JSDoc).parent; } - Debug.assert(node.parent!.kind === SyntaxKind.JSDocComment); - return node.parent!.parent!; } export function getTypeParameterFromJsDoc(node: TypeParameterDeclaration & { parent: JSDocTemplateTag }): TypeParameterDeclaration | undefined { @@ -1938,13 +1938,14 @@ namespace ts { return find(typeParameters, p => p.name.escapedText === name); } - export function hasRestParameter(s: SignatureDeclaration): boolean { - const last = lastOrUndefined(s.parameters); + export function hasRestParameter(s: SignatureDeclaration | JSDocSignature): boolean { + const last = lastOrUndefined(s.parameters); return last && isRestParameter(last); } - export function isRestParameter(node: ParameterDeclaration): boolean { - return node.dotDotDotToken !== undefined || node.type && node.type.kind === SyntaxKind.JSDocVariadicType; + export function isRestParameter(node: ParameterDeclaration | JSDocParameterTag): boolean { + const type = isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; + return (node as ParameterDeclaration).dotDotDotToken !== undefined || type && type.kind === SyntaxKind.JSDocVariadicType; } export const enum AssignmentKind { @@ -2998,8 +2999,9 @@ namespace ts { return parameter && parameter.type; } - export function getThisParameter(signature: SignatureDeclaration): ParameterDeclaration | undefined { - if (signature.parameters.length) { + export function getThisParameter(signature: SignatureDeclaration | JSDocSignature): ParameterDeclaration | undefined { + // callback tags do not currently support this parameters + if (signature.parameters.length && !isJSDocSignature(signature)) { const thisParameter = signature.parameters[0]; if (parameterIsThisKeyword(thisParameter)) { return thisParameter; @@ -3085,7 +3087,10 @@ namespace ts { * Gets the effective return type annotation of a signature. If the node was parsed in a * JavaScript file, gets the return type annotation from JSDoc. */ - export function getEffectiveReturnTypeNode(node: SignatureDeclaration): TypeNode | undefined { + export function getEffectiveReturnTypeNode(node: SignatureDeclaration | JSDocSignature): TypeNode | undefined { + if (isJSDocSignature(node)) { + return node.type && node.type.typeExpression && node.type.typeExpression.type; + } return node.type || (isInJavaScriptFile(node) ? getJSDocReturnType(node) : undefined); } @@ -3093,15 +3098,30 @@ namespace ts { * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. */ - export function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters | JSDocTypedefTag) { - return isJSDocTypedefTag(node) - ? getJSDocTypeParameterDeclarations(node) - : node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined); + export function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters) { + if (isJSDocSignature(node)) { + return undefined; + } + if (isJSDocTypeAlias(node)) { + Debug.assert(node.parent.kind === SyntaxKind.JSDocComment); + const templateTags = flatMap(filter(node.parent.tags, isJSDocTemplateTag), tag => tag.typeParameters) as ReadonlyArray; + const templateTagNodes = templateTags as NodeArray; + templateTagNodes.pos = templateTagNodes.length > 0 ? first(templateTagNodes).pos : node.pos; + templateTagNodes.end = templateTagNodes.length > 0 ? last(templateTagNodes).end : node.end; + templateTagNodes.hasTrailingComma = false; + return templateTagNodes; + } + return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined); } - export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters | JSDocTypedefTag) { - const templateTag = getJSDocTemplateTag(node); - return templateTag && templateTag.typeParameters; + export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters) { + const tags = filter(getJSDocTags(node), isJSDocTemplateTag); + for (const tag of tags) { + if (!(tag.parent.kind === SyntaxKind.JSDocComment && find(tag.parent.tags, isJSDocTypeAlias))) { + // template tags are only available when a typedef isn't already using them + return tag.typeParameters; + } + } } /** @@ -4638,6 +4658,8 @@ namespace ts { return undefined; } } + case SyntaxKind.JSDocCallbackTag: + return (declaration as JSDocCallbackTag).name; case SyntaxKind.JSDocTypedefTag: return getNameOfJSDocTypedef(declaration as JSDocTypedefTag); case SyntaxKind.ExportAssignment: { @@ -5475,6 +5497,14 @@ namespace ts { export function isJSDocTypeLiteral(node: Node): node is JSDocTypeLiteral { return node.kind === SyntaxKind.JSDocTypeLiteral; } + + export function isJSDocCallbackTag(node: Node): node is JSDocCallbackTag { + return node.kind === SyntaxKind.JSDocCallbackTag; + } + + export function isJSDocSignature(node: Node): node is JSDocSignature { + return node.kind === SyntaxKind.JSDocSignature; + } } // Node tests @@ -5636,6 +5666,7 @@ namespace ts { switch (kind) { case SyntaxKind.MethodSignature: case SyntaxKind.CallSignature: + case SyntaxKind.JSDocSignature: case SyntaxKind.ConstructSignature: case SyntaxKind.IndexSignature: case SyntaxKind.FunctionType: @@ -6104,6 +6135,7 @@ namespace ts { || kind === SyntaxKind.TypeParameter || kind === SyntaxKind.VariableDeclaration || kind === SyntaxKind.JSDocTypedefTag + || kind === SyntaxKind.JSDocCallbackTag || kind === SyntaxKind.JSDocPropertyTag; } @@ -6254,7 +6286,7 @@ namespace ts { /** True if node is of a kind that may contain comment text. */ export function isJSDocCommentContainingNode(node: Node): boolean { - return node.kind === SyntaxKind.JSDocComment || isJSDocTag(node) || isJSDocTypeLiteral(node); + return node.kind === SyntaxKind.JSDocComment || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node); } // TODO: determine what this does before making it public. diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index 5b411bedde4..5d7e019c28d 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -93,7 +93,7 @@ namespace ts.codefix { } function getToken(sourceFile: SourceFile, pos: number): Node { - const token = findPrecedingToken(pos, sourceFile); + const token = findPrecedingToken(pos, sourceFile, /*startNode*/ undefined, /*includeJsDoc*/ true); // this handles var ["computed"] = 12; return token.kind === SyntaxKind.CloseBracketToken ? findPrecedingToken(pos - 1, sourceFile) : token; } @@ -152,7 +152,7 @@ namespace ts.codefix { break; case SyntaxKind.TypeParameter: - const typeParameters = (parent.parent).typeParameters; + const typeParameters = getEffectiveTypeParameterDeclarations(parent.parent); if (typeParameters.length === 1) { const previousToken = getTokenAtPosition(sourceFile, typeParameters.pos - 1, /*includeJsDocComment*/ false); const nextToken = getTokenAtPosition(sourceFile, typeParameters.end, /*includeJsDocComment*/ false); @@ -315,4 +315,4 @@ namespace ts.codefix { } } } -} \ No newline at end of file +} diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index ca0dafbc74c..c8958ad3d2f 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -5,6 +5,7 @@ namespace ts.JsDoc { "author", "argument", "borrows", + "callback", "class", "constant", "constructor", @@ -68,10 +69,12 @@ namespace ts.JsDoc { function getCommentHavingNodes(declaration: Declaration): ReadonlyArray { switch (declaration.kind) { + case SyntaxKind.JSDocParameterTag: case SyntaxKind.JSDocPropertyTag: return [declaration as JSDocPropertyTag]; + case SyntaxKind.JSDocCallbackTag: case SyntaxKind.JSDocTypedefTag: - return [(declaration as JSDocTypedefTag).parent]; + return [(declaration as JSDocTypedefTag), (declaration as JSDocTypedefTag).parent]; default: return getJSDocCommentsAndTags(declaration); } @@ -98,6 +101,7 @@ namespace ts.JsDoc { case SyntaxKind.JSDocTypeTag: return withNode((tag as JSDocTypeTag).typeExpression); case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: case SyntaxKind.JSDocPropertyTag: case SyntaxKind.JSDocParameterTag: const { name } = tag as JSDocTypedefTag | JSDocPropertyTag | JSDocParameterTag; diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index b029796e718..3ce18b91002 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -290,7 +290,7 @@ namespace ts.NavigationBar { if (hasJSDocNodes(node)) { forEach(node.jsDoc, jsDoc => { forEach(jsDoc.tags, tag => { - if (tag.kind === SyntaxKind.JSDocTypedefTag) { + if (isJSDocTypeAlias(tag)) { addLeafNode(tag); } }); @@ -414,8 +414,6 @@ namespace ts.NavigationBar { case SyntaxKind.ArrowFunction: case SyntaxKind.ClassExpression: return getFunctionOrClassName(node); - case SyntaxKind.JSDocTypedefTag: - return getJSDocTypedefTagName(node); default: return undefined; } @@ -460,31 +458,11 @@ namespace ts.NavigationBar { return "()"; case SyntaxKind.IndexSignature: return "[]"; - case SyntaxKind.JSDocTypedefTag: - return getJSDocTypedefTagName(node); default: return ""; } } - function getJSDocTypedefTagName(node: JSDocTypedefTag): string { - if (node.name) { - return node.name.text; - } - else { - const parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === SyntaxKind.VariableStatement) { - if (parentNode.declarationList.declarations.length > 0) { - const nameIdentifier = parentNode.declarationList.declarations[0].name; - if (nameIdentifier.kind === SyntaxKind.Identifier) { - return nameIdentifier.text; - } - } - } - return ""; - } - } - /** Flattens the NavNode tree to a list, keeping only the top-level items. */ function topLevelItems(root: NavigationBarNode): NavigationBarNode[] { const topLevel: NavigationBarNode[] = []; @@ -511,6 +489,7 @@ namespace ts.NavigationBar { case SyntaxKind.SourceFile: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: return true; case SyntaxKind.Constructor: diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 354c2002179..4c5d7ff6f09 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1464,8 +1464,8 @@ namespace ts.refactor.extractSymbol { } // Note that we add the current node's type parameters *after* updating the corresponding scope. - if (isDeclarationWithTypeParameters(curr) && curr.typeParameters) { - for (const typeParameterDecl of curr.typeParameters) { + if (isDeclarationWithTypeParameters(curr) && getEffectiveTypeParameterDeclarations(curr)) { + for (const typeParameterDecl of getEffectiveTypeParameterDeclarations(curr)) { const typeParameter = checker.getTypeAtLocation(typeParameterDecl) as TypeParameter; if (allTypeParameterUsages.has(typeParameter.id.toString())) { seenTypeParameterUsages.set(typeParameter.id.toString(), typeParameter); @@ -1536,8 +1536,8 @@ namespace ts.refactor.extractSymbol { function hasTypeParameters(node: Node) { return isDeclarationWithTypeParameters(node) && - node.typeParameters !== undefined && - node.typeParameters.length > 0; + getEffectiveTypeParameterDeclarations(node) && + getEffectiveTypeParameterDeclarations(node).length > 0; } function isInGenericContext(node: Node) { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 430dc2196e0..399b7184e62 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -276,7 +276,7 @@ namespace ts { } export function getContainerNode(node: Node): Declaration { - if (node.kind === SyntaxKind.JSDocTypedefTag) { + if (isJSDocTypeAlias(node)) { // This doesn't just apply to the node immediately under the comment, but to everything in its parent's scope. // node.parent = the JSDoc comment, node.parent.parent = the node having the comment. // Then we get parent again in the loop. @@ -315,7 +315,10 @@ namespace ts { case SyntaxKind.ClassExpression: return ScriptElementKind.classElement; case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; - case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.JSDocCallbackTag: + case SyntaxKind.JSDocTypedefTag: + return ScriptElementKind.typeElement; case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; case SyntaxKind.VariableDeclaration: return getKindOfVariableDeclaration(node); @@ -346,8 +349,6 @@ namespace ts { case SyntaxKind.ExportSpecifier: case SyntaxKind.NamespaceImport: return ScriptElementKind.alias; - case SyntaxKind.JSDocTypedefTag: - return ScriptElementKind.typeElement; case SyntaxKind.BinaryExpression: const kind = getSpecialPropertyAssignmentKind(node as BinaryExpression); const { right } = node as BinaryExpression; diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json index a4a69fc48a6..98a59931ad8 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json @@ -32,7 +32,7 @@ }, "typeExpression": { "kind": "JSDocTypeLiteral", - "pos": 26, + "pos": 28, "end": 98, "jsDocPropertyTags": [ { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 67bd6cbe980..1cf0b12522b 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -349,22 +349,24 @@ declare namespace ts { JSDocVariadicType = 284, JSDocComment = 285, JSDocTypeLiteral = 286, - JSDocTag = 287, - JSDocAugmentsTag = 288, - JSDocClassTag = 289, - JSDocParameterTag = 290, - JSDocReturnTag = 291, - JSDocTypeTag = 292, - JSDocTemplateTag = 293, - JSDocTypedefTag = 294, - JSDocPropertyTag = 295, - SyntaxList = 296, - NotEmittedStatement = 297, - PartiallyEmittedExpression = 298, - CommaListExpression = 299, - MergeDeclarationMarker = 300, - EndOfDeclarationMarker = 301, - Count = 302, + JSDocSignature = 287, + JSDocTag = 288, + JSDocAugmentsTag = 289, + JSDocClassTag = 290, + JSDocCallbackTag = 291, + JSDocParameterTag = 292, + JSDocReturnTag = 293, + JSDocTypeTag = 294, + JSDocTemplateTag = 295, + JSDocTypedefTag = 296, + JSDocPropertyTag = 297, + SyntaxList = 298, + NotEmittedStatement = 299, + PartiallyEmittedExpression = 300, + CommaListExpression = 301, + MergeDeclarationMarker = 302, + EndOfDeclarationMarker = 303, + Count = 304, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -391,9 +393,9 @@ declare namespace ts { LastBinaryOperator = 70, FirstNode = 145, FirstJSDocNode = 277, - LastJSDocNode = 295, - FirstJSDocTagNode = 287, - LastJSDocTagNode = 295 + LastJSDocNode = 297, + FirstJSDocTagNode = 288, + LastJSDocTagNode = 297 } enum NodeFlags { None = 0, @@ -1280,7 +1282,7 @@ declare namespace ts { block: Block; } type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode; - type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag; + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature; interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer { kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression; name?: Identifier; @@ -1537,6 +1539,19 @@ declare namespace ts { name?: Identifier; typeExpression?: JSDocTypeExpression | JSDocTypeLiteral; } + interface JSDocCallbackTag extends JSDocTag, NamedDeclaration { + parent: JSDoc; + kind: SyntaxKind.JSDocCallbackTag; + fullName?: JSDocNamespaceDeclaration | Identifier; + name?: Identifier; + typeExpression: JSDocSignature; + } + interface JSDocSignature extends JSDocType, Declaration { + kind: SyntaxKind.JSDocSignature; + typeParameters?: ReadonlyArray; + parameters: ReadonlyArray; + type: JSDocReturnTag | undefined; + } interface JSDocPropertyLikeTag extends JSDocTag, Declaration { parent: JSDoc; name: EntityName; @@ -2283,7 +2298,7 @@ declare namespace ts { Construct = 1 } interface Signature { - declaration?: SignatureDeclaration; + declaration?: SignatureDeclaration | JSDocSignature; typeParameters?: TypeParameter[]; parameters: Symbol[]; } @@ -3362,6 +3377,8 @@ declare namespace ts { function isJSDocPropertyTag(node: Node): node is JSDocPropertyTag; function isJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag; function isJSDocTypeLiteral(node: Node): node is JSDocTypeLiteral; + function isJSDocCallbackTag(node: Node): node is JSDocCallbackTag; + function isJSDocSignature(node: Node): node is JSDocSignature; } declare namespace ts { /** diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index ef435632a36..35669b096e3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -349,22 +349,24 @@ declare namespace ts { JSDocVariadicType = 284, JSDocComment = 285, JSDocTypeLiteral = 286, - JSDocTag = 287, - JSDocAugmentsTag = 288, - JSDocClassTag = 289, - JSDocParameterTag = 290, - JSDocReturnTag = 291, - JSDocTypeTag = 292, - JSDocTemplateTag = 293, - JSDocTypedefTag = 294, - JSDocPropertyTag = 295, - SyntaxList = 296, - NotEmittedStatement = 297, - PartiallyEmittedExpression = 298, - CommaListExpression = 299, - MergeDeclarationMarker = 300, - EndOfDeclarationMarker = 301, - Count = 302, + JSDocSignature = 287, + JSDocTag = 288, + JSDocAugmentsTag = 289, + JSDocClassTag = 290, + JSDocCallbackTag = 291, + JSDocParameterTag = 292, + JSDocReturnTag = 293, + JSDocTypeTag = 294, + JSDocTemplateTag = 295, + JSDocTypedefTag = 296, + JSDocPropertyTag = 297, + SyntaxList = 298, + NotEmittedStatement = 299, + PartiallyEmittedExpression = 300, + CommaListExpression = 301, + MergeDeclarationMarker = 302, + EndOfDeclarationMarker = 303, + Count = 304, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -391,9 +393,9 @@ declare namespace ts { LastBinaryOperator = 70, FirstNode = 145, FirstJSDocNode = 277, - LastJSDocNode = 295, - FirstJSDocTagNode = 287, - LastJSDocTagNode = 295 + LastJSDocNode = 297, + FirstJSDocTagNode = 288, + LastJSDocTagNode = 297 } enum NodeFlags { None = 0, @@ -1280,7 +1282,7 @@ declare namespace ts { block: Block; } type ObjectTypeDeclaration = ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode; - type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag; + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag | JSDocTypedefTag | JSDocCallbackTag | JSDocSignature; interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer { kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression; name?: Identifier; @@ -1537,6 +1539,19 @@ declare namespace ts { name?: Identifier; typeExpression?: JSDocTypeExpression | JSDocTypeLiteral; } + interface JSDocCallbackTag extends JSDocTag, NamedDeclaration { + parent: JSDoc; + kind: SyntaxKind.JSDocCallbackTag; + fullName?: JSDocNamespaceDeclaration | Identifier; + name?: Identifier; + typeExpression: JSDocSignature; + } + interface JSDocSignature extends JSDocType, Declaration { + kind: SyntaxKind.JSDocSignature; + typeParameters?: ReadonlyArray; + parameters: ReadonlyArray; + type: JSDocReturnTag | undefined; + } interface JSDocPropertyLikeTag extends JSDocTag, Declaration { parent: JSDoc; name: EntityName; @@ -2283,7 +2298,7 @@ declare namespace ts { Construct = 1 } interface Signature { - declaration?: SignatureDeclaration; + declaration?: SignatureDeclaration | JSDocSignature; typeParameters?: TypeParameter[]; parameters: Symbol[]; } @@ -3362,6 +3377,8 @@ declare namespace ts { function isJSDocPropertyTag(node: Node): node is JSDocPropertyTag; function isJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag; function isJSDocTypeLiteral(node: Node): node is JSDocTypeLiteral; + function isJSDocCallbackTag(node: Node): node is JSDocCallbackTag; + function isJSDocSignature(node: Node): node is JSDocSignature; } declare namespace ts { /** diff --git a/tests/baselines/reference/callbackCrossModule.symbols b/tests/baselines/reference/callbackCrossModule.symbols new file mode 100644 index 00000000000..be8175c4a11 --- /dev/null +++ b/tests/baselines/reference/callbackCrossModule.symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/jsdoc/mod1.js === +/** @callback Con - some kind of continuation + * @param {object | undefined} error + * @return {any} I don't even know what this should return + */ +module.exports = C +>module : Symbol(export=, Decl(mod1.js, 0, 0)) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>C : Symbol(C, Decl(mod1.js, 4, 18)) + +function C() { +>C : Symbol(C, Decl(mod1.js, 4, 18)) + + this.p = 1 +>p : Symbol(C.p, Decl(mod1.js, 5, 14)) +} + +=== tests/cases/conformance/jsdoc/use.js === +/** @param {import('./mod1').Con} k */ +function f(k) { +>f : Symbol(f, Decl(use.js, 0, 0)) +>k : Symbol(k, Decl(use.js, 1, 11)) + + if (1 === 2 - 1) { + // I guess basic math works! + } + return k({ ok: true}) +>k : Symbol(k, Decl(use.js, 1, 11)) +>ok : Symbol(ok, Decl(use.js, 5, 14)) +} + + diff --git a/tests/baselines/reference/callbackCrossModule.types b/tests/baselines/reference/callbackCrossModule.types new file mode 100644 index 00000000000..d1d970c555e --- /dev/null +++ b/tests/baselines/reference/callbackCrossModule.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/jsdoc/mod1.js === +/** @callback Con - some kind of continuation + * @param {object | undefined} error + * @return {any} I don't even know what this should return + */ +module.exports = C +>module.exports = C : typeof C +>module.exports : any +>module : any +>exports : any +>C : typeof C + +function C() { +>C : typeof C + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} + +=== tests/cases/conformance/jsdoc/use.js === +/** @param {import('./mod1').Con} k */ +function f(k) { +>f : (k: (error: any) => any) => any +>k : (error: any) => any + + if (1 === 2 - 1) { +>1 === 2 - 1 : boolean +>1 : 1 +>2 - 1 : number +>2 : 2 +>1 : 1 + + // I guess basic math works! + } + return k({ ok: true}) +>k({ ok: true}) : any +>k : (error: any) => any +>{ ok: true} : { ok: boolean; } +>ok : boolean +>true : true +} + + diff --git a/tests/baselines/reference/callbackTag1.symbols b/tests/baselines/reference/callbackTag1.symbols new file mode 100644 index 00000000000..b52ac8f92c8 --- /dev/null +++ b/tests/baselines/reference/callbackTag1.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/jsdoc/cb.js === +/** @callback Sid + * @param {string} s + * @returns {string} What were you expecting + */ +var x = 1 +>x : Symbol(x, Decl(cb.js, 4, 3)) + +/** @type {Sid} smallId */ +var sid = s => s + "!"; +>sid : Symbol(sid, Decl(cb.js, 7, 3)) +>s : Symbol(s, Decl(cb.js, 7, 9)) +>s : Symbol(s, Decl(cb.js, 7, 9)) + + +/** @type {NoReturn} */ +var noreturn = obj => void obj.title +>noreturn : Symbol(noreturn, Decl(cb.js, 11, 3)) +>obj : Symbol(obj, Decl(cb.js, 11, 14)) +>obj.title : Symbol(title, Decl(cb.js, 15, 34)) +>obj : Symbol(obj, Decl(cb.js, 11, 14)) +>title : Symbol(title, Decl(cb.js, 15, 34)) + +/** + * @callback NoReturn + * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc + */ + diff --git a/tests/baselines/reference/callbackTag1.types b/tests/baselines/reference/callbackTag1.types new file mode 100644 index 00000000000..2f1e64c8edc --- /dev/null +++ b/tests/baselines/reference/callbackTag1.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/jsdoc/cb.js === +/** @callback Sid + * @param {string} s + * @returns {string} What were you expecting + */ +var x = 1 +>x : number +>1 : 1 + +/** @type {Sid} smallId */ +var sid = s => s + "!"; +>sid : Sid +>s => s + "!" : (s: string) => string +>s : string +>s + "!" : string +>s : string +>"!" : "!" + + +/** @type {NoReturn} */ +var noreturn = obj => void obj.title +>noreturn : (s: { e: number; m: number; title: string; }) => any +>obj => void obj.title : (obj: { e: number; m: number; title: string; }) => any +>obj : { e: number; m: number; title: string; } +>void obj.title : undefined +>obj.title : string +>obj : { e: number; m: number; title: string; } +>title : string + +/** + * @callback NoReturn + * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc + */ + diff --git a/tests/baselines/reference/callbackTag2.errors.txt b/tests/baselines/reference/callbackTag2.errors.txt new file mode 100644 index 00000000000..8be9e901020 --- /dev/null +++ b/tests/baselines/reference/callbackTag2.errors.txt @@ -0,0 +1,42 @@ +tests/cases/conformance/jsdoc/cb.js(18,29): error TS2304: Cannot find name 'S'. + + +==== tests/cases/conformance/jsdoc/cb.js (1 errors) ==== + /** @template T + * @callback Id + * @param {T} t + * @returns {T} Maybe just return 120 and cast it? + */ + var x = 1 + + /** @type {Id} I actually wanted to write `const "120"` */ + var one_twenty = s => "120"; + + /** @template S + * @callback SharedId + * @param {S} ego + * @return {S} + */ + class SharedClass { + constructor() { + /** @type {SharedId} */ + ~ +!!! error TS2304: Cannot find name 'S'. + this.id; + } + } + /** @type {SharedId} */ + var outside = n => n + 1; + + /** @type {Final<{ fantasy }, { heroes }>} */ + var noreturn = (barts, tidus, noctis) => "cecil" + + /** + * @template V,X + * @callback Final + * @param {V} barts - "Barts" + * @param {X} tidus - Titus + * @param {X & V} noctis - "Prince Noctis Lucius Caelum" + * @return {"cecil" | "zidane"} + */ + \ No newline at end of file diff --git a/tests/baselines/reference/callbackTag2.symbols b/tests/baselines/reference/callbackTag2.symbols new file mode 100644 index 00000000000..36b810de465 --- /dev/null +++ b/tests/baselines/reference/callbackTag2.symbols @@ -0,0 +1,52 @@ +=== tests/cases/conformance/jsdoc/cb.js === +/** @template T + * @callback Id + * @param {T} t + * @returns {T} Maybe just return 120 and cast it? + */ +var x = 1 +>x : Symbol(x, Decl(cb.js, 5, 3)) + +/** @type {Id} I actually wanted to write `const "120"` */ +var one_twenty = s => "120"; +>one_twenty : Symbol(one_twenty, Decl(cb.js, 8, 3)) +>s : Symbol(s, Decl(cb.js, 8, 16)) + +/** @template S + * @callback SharedId + * @param {S} ego + * @return {S} + */ +class SharedClass { +>SharedClass : Symbol(SharedClass, Decl(cb.js, 8, 28)) + + constructor() { + /** @type {SharedId} */ + this.id; +>this.id : Symbol(SharedClass.id, Decl(cb.js, 16, 19)) +>this : Symbol(SharedClass, Decl(cb.js, 8, 28)) +>id : Symbol(SharedClass.id, Decl(cb.js, 16, 19)) + } +} +/** @type {SharedId} */ +var outside = n => n + 1; +>outside : Symbol(outside, Decl(cb.js, 22, 3)) +>n : Symbol(n, Decl(cb.js, 22, 13)) +>n : Symbol(n, Decl(cb.js, 22, 13)) + +/** @type {Final<{ fantasy }, { heroes }>} */ +var noreturn = (barts, tidus, noctis) => "cecil" +>noreturn : Symbol(noreturn, Decl(cb.js, 25, 3)) +>barts : Symbol(barts, Decl(cb.js, 25, 16)) +>tidus : Symbol(tidus, Decl(cb.js, 25, 22)) +>noctis : Symbol(noctis, Decl(cb.js, 25, 29)) + +/** + * @template V,X + * @callback Final + * @param {V} barts - "Barts" + * @param {X} tidus - Titus + * @param {X & V} noctis - "Prince Noctis Lucius Caelum" + * @return {"cecil" | "zidane"} + */ + diff --git a/tests/baselines/reference/callbackTag2.types b/tests/baselines/reference/callbackTag2.types new file mode 100644 index 00000000000..5a13438ebbe --- /dev/null +++ b/tests/baselines/reference/callbackTag2.types @@ -0,0 +1,60 @@ +=== tests/cases/conformance/jsdoc/cb.js === +/** @template T + * @callback Id + * @param {T} t + * @returns {T} Maybe just return 120 and cast it? + */ +var x = 1 +>x : number +>1 : 1 + +/** @type {Id} I actually wanted to write `const "120"` */ +var one_twenty = s => "120"; +>one_twenty : Id +>s => "120" : (s: string) => string +>s : string +>"120" : "120" + +/** @template S + * @callback SharedId + * @param {S} ego + * @return {S} + */ +class SharedClass { +>SharedClass : SharedClass + + constructor() { + /** @type {SharedId} */ + this.id; +>this.id : SharedId +>this : this +>id : SharedId + } +} +/** @type {SharedId} */ +var outside = n => n + 1; +>outside : SharedId +>n => n + 1 : (n: number) => number +>n : number +>n + 1 : number +>n : number +>1 : 1 + +/** @type {Final<{ fantasy }, { heroes }>} */ +var noreturn = (barts, tidus, noctis) => "cecil" +>noreturn : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { heroes: any; } & { fantasy: any; }) => "cecil" | "zidane" +>(barts, tidus, noctis) => "cecil" : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { heroes: any; } & { fantasy: any; }) => "cecil" +>barts : { fantasy: any; } +>tidus : { heroes: any; } +>noctis : { heroes: any; } & { fantasy: any; } +>"cecil" : "cecil" + +/** + * @template V,X + * @callback Final + * @param {V} barts - "Barts" + * @param {X} tidus - Titus + * @param {X & V} noctis - "Prince Noctis Lucius Caelum" + * @return {"cecil" | "zidane"} + */ + diff --git a/tests/baselines/reference/callbackTag3.symbols b/tests/baselines/reference/callbackTag3.symbols new file mode 100644 index 00000000000..88b53a4cdaa --- /dev/null +++ b/tests/baselines/reference/callbackTag3.symbols @@ -0,0 +1,9 @@ +=== tests/cases/conformance/jsdoc/cb.js === +/** @callback Miracle + * @returns {string} What were you expecting + */ +/** @type {Miracle} smallId */ +var sid = () => "!"; +>sid : Symbol(sid, Decl(cb.js, 4, 3)) + + diff --git a/tests/baselines/reference/callbackTag3.types b/tests/baselines/reference/callbackTag3.types new file mode 100644 index 00000000000..836897d0f30 --- /dev/null +++ b/tests/baselines/reference/callbackTag3.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/jsdoc/cb.js === +/** @callback Miracle + * @returns {string} What were you expecting + */ +/** @type {Miracle} smallId */ +var sid = () => "!"; +>sid : Miracle +>() => "!" : () => string +>"!" : "!" + + diff --git a/tests/baselines/reference/callbackTagNamespace.symbols b/tests/baselines/reference/callbackTagNamespace.symbols new file mode 100644 index 00000000000..b8cf7d95886 --- /dev/null +++ b/tests/baselines/reference/callbackTagNamespace.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/jsdoc/namespaced.js === +/** + * @callback NS.Nested.Inner + * @param {string} space - spaaaaaaaaace + * @param {string} peace - peaaaaaaaaace + * @return {string | number} + */ +var x = 1; +>x : Symbol(x, Decl(namespaced.js, 6, 3)) + +/** @type {NS.Nested.Inner} */ +function f(space, peace) { +>f : Symbol(f, Decl(namespaced.js, 6, 10)) +>space : Symbol(space, Decl(namespaced.js, 8, 11)) +>peace : Symbol(peace, Decl(namespaced.js, 8, 17)) + + return '1' +} + diff --git a/tests/baselines/reference/callbackTagNamespace.types b/tests/baselines/reference/callbackTagNamespace.types new file mode 100644 index 00000000000..0435320795d --- /dev/null +++ b/tests/baselines/reference/callbackTagNamespace.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/jsdoc/namespaced.js === +/** + * @callback NS.Nested.Inner + * @param {string} space - spaaaaaaaaace + * @param {string} peace - peaaaaaaaaace + * @return {string | number} + */ +var x = 1; +>x : number +>1 : 1 + +/** @type {NS.Nested.Inner} */ +function f(space, peace) { +>f : (space: string, peace: string) => string +>space : string +>peace : string + + return '1' +>'1' : "1" +} + diff --git a/tests/baselines/reference/jsdocTemplateClass.errors.txt b/tests/baselines/reference/jsdocTemplateClass.errors.txt index 4598e9f320f..402992c34bd 100644 --- a/tests/baselines/reference/jsdocTemplateClass.errors.txt +++ b/tests/baselines/reference/jsdocTemplateClass.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsdoc/templateTagOnClasses.js(24,1): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/templateTagOnClasses.js(25,1): error TS2322: Type 'boolean' is not assignable to type 'number'. ==== tests/cases/conformance/jsdoc/templateTagOnClasses.js (1 errors) ==== @@ -6,6 +6,7 @@ tests/cases/conformance/jsdoc/templateTagOnClasses.js(24,1): error TS2322: Type * @template {T} * @typedef {(t: T) => T} Id */ + /** @template T */ class Foo { /** @typedef {(t: T) => T} Id2 */ /** @param {T} x */ @@ -15,7 +16,7 @@ tests/cases/conformance/jsdoc/templateTagOnClasses.js(24,1): error TS2322: Type /** * * @param {T} x - * @param {Id} y + * @param {Id} y * @param {Id2} alpha * @return {T} */ diff --git a/tests/baselines/reference/jsdocTemplateClass.symbols b/tests/baselines/reference/jsdocTemplateClass.symbols index d80b73bc4ac..b82cd8038e5 100644 --- a/tests/baselines/reference/jsdocTemplateClass.symbols +++ b/tests/baselines/reference/jsdocTemplateClass.symbols @@ -3,52 +3,53 @@ * @template {T} * @typedef {(t: T) => T} Id */ +/** @template T */ class Foo { >Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) /** @typedef {(t: T) => T} Id2 */ /** @param {T} x */ constructor (x) { ->x : Symbol(x, Decl(templateTagOnClasses.js, 7, 17)) +>x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) this.a = x ->this.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21)) +>this.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 8, 21)) >this : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) ->a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21)) ->x : Symbol(x, Decl(templateTagOnClasses.js, 7, 17)) +>a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 8, 21)) +>x : Symbol(x, Decl(templateTagOnClasses.js, 8, 17)) } /** * * @param {T} x - * @param {Id} y + * @param {Id} y * @param {Id2} alpha * @return {T} */ foo(x, y, alpha) { ->foo : Symbol(Foo.foo, Decl(templateTagOnClasses.js, 9, 5)) ->x : Symbol(x, Decl(templateTagOnClasses.js, 17, 8)) ->y : Symbol(y, Decl(templateTagOnClasses.js, 17, 10)) ->alpha : Symbol(alpha, Decl(templateTagOnClasses.js, 17, 13)) +>foo : Symbol(Foo.foo, Decl(templateTagOnClasses.js, 10, 5)) +>x : Symbol(x, Decl(templateTagOnClasses.js, 18, 8)) +>y : Symbol(y, Decl(templateTagOnClasses.js, 18, 10)) +>alpha : Symbol(alpha, Decl(templateTagOnClasses.js, 18, 13)) return alpha(y(x)) ->alpha : Symbol(alpha, Decl(templateTagOnClasses.js, 17, 13)) ->y : Symbol(y, Decl(templateTagOnClasses.js, 17, 10)) ->x : Symbol(x, Decl(templateTagOnClasses.js, 17, 8)) +>alpha : Symbol(alpha, Decl(templateTagOnClasses.js, 18, 13)) +>y : Symbol(y, Decl(templateTagOnClasses.js, 18, 10)) +>x : Symbol(x, Decl(templateTagOnClasses.js, 18, 8)) } } var f = new Foo(1) ->f : Symbol(f, Decl(templateTagOnClasses.js, 21, 3)) +>f : Symbol(f, Decl(templateTagOnClasses.js, 22, 3)) >Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) var g = new Foo(false) ->g : Symbol(g, Decl(templateTagOnClasses.js, 22, 3)) +>g : Symbol(g, Decl(templateTagOnClasses.js, 23, 3)) >Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0)) f.a = g.a ->f.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21)) ->f : Symbol(f, Decl(templateTagOnClasses.js, 21, 3)) ->a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21)) ->g.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21)) ->g : Symbol(g, Decl(templateTagOnClasses.js, 22, 3)) ->a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21)) +>f.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 8, 21)) +>f : Symbol(f, Decl(templateTagOnClasses.js, 22, 3)) +>a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 8, 21)) +>g.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 8, 21)) +>g : Symbol(g, Decl(templateTagOnClasses.js, 23, 3)) +>a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 8, 21)) diff --git a/tests/baselines/reference/jsdocTemplateClass.types b/tests/baselines/reference/jsdocTemplateClass.types index aa6a685e34f..9c028a96ff1 100644 --- a/tests/baselines/reference/jsdocTemplateClass.types +++ b/tests/baselines/reference/jsdocTemplateClass.types @@ -3,6 +3,7 @@ * @template {T} * @typedef {(t: T) => T} Id */ +/** @template T */ class Foo { >Foo : Foo @@ -21,7 +22,7 @@ class Foo { /** * * @param {T} x - * @param {Id} y + * @param {Id} y * @param {Id2} alpha * @return {T} */ diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt b/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt index 225d277c4ff..9e735b780a0 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction.errors.txt @@ -1,11 +1,14 @@ -tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js(21,1): error TS2322: Type 'false' is not assignable to type 'number'. +tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js(24,1): error TS2322: Type 'false' is not assignable to type 'number'. ==== tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js (1 errors) ==== /** - * @template {T} - * @typedef {(t: T) => T} Id + * @template {U} + * @typedef {(u: U) => U} Id + */ + /** * @param {T} t + * @template {T} */ function Zet(t) { /** @type {T} */ @@ -14,7 +17,7 @@ tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js(21,1): error } /** * @param {T} v - * @param {Id} id + * @param {Id} id */ Zet.prototype.add = function(v, id) { this.u = v || this.t diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols b/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols index 8cf2ee99e57..b640d3c1e21 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction.symbols @@ -1,57 +1,60 @@ === tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js === /** - * @template {T} - * @typedef {(t: T) => T} Id + * @template {U} + * @typedef {(u: U) => U} Id + */ +/** * @param {T} t + * @template {T} */ function Zet(t) { >Zet : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0)) ->t : Symbol(t, Decl(templateTagOnConstructorFunctions.js, 5, 13)) +>t : Symbol(t, Decl(templateTagOnConstructorFunctions.js, 8, 13)) /** @type {T} */ this.u this.t = t ->t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10)) ->t : Symbol(t, Decl(templateTagOnConstructorFunctions.js, 5, 13)) +>t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 10, 10)) +>t : Symbol(t, Decl(templateTagOnConstructorFunctions.js, 8, 13)) } /** * @param {T} v - * @param {Id} id + * @param {Id} id */ Zet.prototype.add = function(v, id) { ->Zet.prototype : Symbol(Zet.add, Decl(templateTagOnConstructorFunctions.js, 9, 1)) +>Zet.prototype : Symbol(Zet.add, Decl(templateTagOnConstructorFunctions.js, 12, 1)) >Zet : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0)) >prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --)) ->add : Symbol(Zet.add, Decl(templateTagOnConstructorFunctions.js, 9, 1)) ->v : Symbol(v, Decl(templateTagOnConstructorFunctions.js, 14, 29)) ->id : Symbol(id, Decl(templateTagOnConstructorFunctions.js, 14, 31)) +>add : Symbol(Zet.add, Decl(templateTagOnConstructorFunctions.js, 12, 1)) +>v : Symbol(v, Decl(templateTagOnConstructorFunctions.js, 17, 29)) +>id : Symbol(id, Decl(templateTagOnConstructorFunctions.js, 17, 31)) this.u = v || this.t ->this.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37)) +>this.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37)) >this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0)) ->u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37)) ->v : Symbol(v, Decl(templateTagOnConstructorFunctions.js, 14, 29)) ->this.t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10)) +>u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37)) +>v : Symbol(v, Decl(templateTagOnConstructorFunctions.js, 17, 29)) +>this.t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 10, 10)) >this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0)) ->t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10)) +>t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 10, 10)) return id(this.u) ->id : Symbol(id, Decl(templateTagOnConstructorFunctions.js, 14, 31)) ->this.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37)) +>id : Symbol(id, Decl(templateTagOnConstructorFunctions.js, 17, 31)) +>this.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37)) >this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0)) ->u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37)) +>u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37)) } var z = new Zet(1) ->z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 18, 3)) +>z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 21, 3)) >Zet : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0)) z.t = 2 ->z.t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10)) ->z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 18, 3)) ->t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10)) +>z.t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 10, 10)) +>z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 21, 3)) +>t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 10, 10)) z.u = false ->z.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37)) ->z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 18, 3)) ->u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37)) +>z.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37)) +>z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 21, 3)) +>u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 8, 17), Decl(templateTagOnConstructorFunctions.js, 17, 37)) diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction.types b/tests/baselines/reference/jsdocTemplateConstructorFunction.types index f838534aa33..121cf846a0e 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction.types +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction.types @@ -1,8 +1,11 @@ === tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js === /** - * @template {T} - * @typedef {(t: T) => T} Id + * @template {U} + * @typedef {(u: U) => U} Id + */ +/** * @param {T} t + * @template {T} */ function Zet(t) { >Zet : typeof Zet @@ -23,18 +26,18 @@ function Zet(t) { } /** * @param {T} v - * @param {Id} id + * @param {Id} id */ Zet.prototype.add = function(v, id) { ->Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: (t: T) => T) => T +>Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: (u: T) => T) => T >Zet.prototype.add : any >Zet.prototype : any >Zet : typeof Zet >prototype : any >add : any ->function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: (t: T) => T) => T +>function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: (u: T) => T) => T >v : T ->id : (t: T) => T +>id : (u: T) => T this.u = v || this.t >this.u = v || this.t : T @@ -49,7 +52,7 @@ Zet.prototype.add = function(v, id) { return id(this.u) >id(this.u) : T ->id : (t: T) => T +>id : (u: T) => T >this.u : T >this : Zet >u : T diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt b/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt index 6a8e45566ec..cdcc9a056eb 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction2.errors.txt @@ -4,8 +4,8 @@ tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js(26,15): error ==== tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js (2 errors) ==== /** - * @template {T} * @param {T} t + * @template {T} */ function Zet(t) { /** @type {T} */ diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols b/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols index c65570f84c4..32573a37398 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction2.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js === /** - * @template {T} * @param {T} t + * @template {T} */ function Zet(t) { >Zet : Symbol(Zet, Decl(templateTagWithNestedTypeLiteral.js, 0, 0)) diff --git a/tests/baselines/reference/jsdocTemplateConstructorFunction2.types b/tests/baselines/reference/jsdocTemplateConstructorFunction2.types index 787d9ab106b..14407a5a0c9 100644 --- a/tests/baselines/reference/jsdocTemplateConstructorFunction2.types +++ b/tests/baselines/reference/jsdocTemplateConstructorFunction2.types @@ -1,7 +1,7 @@ === tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js === /** - * @template {T} * @param {T} t + * @template {T} */ function Zet(t) { >Zet : typeof Zet diff --git a/tests/baselines/reference/jsdocTemplateTag2.symbols b/tests/baselines/reference/jsdocTemplateTag2.symbols new file mode 100644 index 00000000000..407943934ff --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag2.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/jsdoc/github17339.js === +var obj = { +>obj : Symbol(obj, Decl(github17339.js, 0, 3)) + + /** + * @template T + * @param {T} a + * @returns {T} + */ + x: function (a) { +>x : Symbol(x, Decl(github17339.js, 0, 11)) +>a : Symbol(a, Decl(github17339.js, 6, 14)) + + return a; +>a : Symbol(a, Decl(github17339.js, 6, 14)) + + }, +}; + diff --git a/tests/baselines/reference/jsdocTemplateTag2.types b/tests/baselines/reference/jsdocTemplateTag2.types new file mode 100644 index 00000000000..d35724fb9b6 --- /dev/null +++ b/tests/baselines/reference/jsdocTemplateTag2.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/jsdoc/github17339.js === +var obj = { +>obj : { [x: string]: any; x: (a: T) => T; } +>{ /** * @template T * @param {T} a * @returns {T} */ x: function (a) { return a; },} : { [x: string]: any; x: (a: T) => T; } + + /** + * @template T + * @param {T} a + * @returns {T} + */ + x: function (a) { +>x : (a: T) => T +>function (a) { return a; } : (a: T) => T +>a : T + + return a; +>a : T + + }, +}; + diff --git a/tests/cases/conformance/jsdoc/callbackCrossModule.ts b/tests/cases/conformance/jsdoc/callbackCrossModule.ts new file mode 100644 index 00000000000..a2888f3627f --- /dev/null +++ b/tests/cases/conformance/jsdoc/callbackCrossModule.ts @@ -0,0 +1,22 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: mod1.js +/** @callback Con - some kind of continuation + * @param {object | undefined} error + * @return {any} I don't even know what this should return + */ +module.exports = C +function C() { + this.p = 1 +} + +// @Filename: use.js +/** @param {import('./mod1').Con} k */ +function f(k) { + if (1 === 2 - 1) { + // I guess basic math works! + } + return k({ ok: true}) +} + diff --git a/tests/cases/conformance/jsdoc/callbackTag1.ts b/tests/cases/conformance/jsdoc/callbackTag1.ts new file mode 100644 index 00000000000..63a90e74ff8 --- /dev/null +++ b/tests/cases/conformance/jsdoc/callbackTag1.ts @@ -0,0 +1,22 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: cb.js + +/** @callback Sid + * @param {string} s + * @returns {string} What were you expecting + */ +var x = 1 + +/** @type {Sid} smallId */ +var sid = s => s + "!"; + + +/** @type {NoReturn} */ +var noreturn = obj => void obj.title + +/** + * @callback NoReturn + * @param {{ e: number, m: number, title: string }} s - Knee deep, shores, etc + */ diff --git a/tests/cases/conformance/jsdoc/callbackTag2.ts b/tests/cases/conformance/jsdoc/callbackTag2.ts new file mode 100644 index 00000000000..34e71b55bcd --- /dev/null +++ b/tests/cases/conformance/jsdoc/callbackTag2.ts @@ -0,0 +1,40 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: cb.js + +/** @template T + * @callback Id + * @param {T} t + * @returns {T} Maybe just return 120 and cast it? + */ +var x = 1 + +/** @type {Id} I actually wanted to write `const "120"` */ +var one_twenty = s => "120"; + +/** @template S + * @callback SharedId + * @param {S} ego + * @return {S} + */ +class SharedClass { + constructor() { + /** @type {SharedId} */ + this.id; + } +} +/** @type {SharedId} */ +var outside = n => n + 1; + +/** @type {Final<{ fantasy }, { heroes }>} */ +var noreturn = (barts, tidus, noctis) => "cecil" + +/** + * @template V,X + * @callback Final + * @param {V} barts - "Barts" + * @param {X} tidus - Titus + * @param {X & V} noctis - "Prince Noctis Lucius Caelum" + * @return {"cecil" | "zidane"} + */ diff --git a/tests/cases/conformance/jsdoc/callbackTag3.ts b/tests/cases/conformance/jsdoc/callbackTag3.ts new file mode 100644 index 00000000000..cb51ed6bb46 --- /dev/null +++ b/tests/cases/conformance/jsdoc/callbackTag3.ts @@ -0,0 +1,10 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: cb.js +/** @callback Miracle + * @returns {string} What were you expecting + */ +/** @type {Miracle} smallId */ +var sid = () => "!"; + diff --git a/tests/cases/conformance/jsdoc/callbackTagNamespace.ts b/tests/cases/conformance/jsdoc/callbackTagNamespace.ts new file mode 100644 index 00000000000..ba331e79fc4 --- /dev/null +++ b/tests/cases/conformance/jsdoc/callbackTagNamespace.ts @@ -0,0 +1,15 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: namespaced.js +/** + * @callback NS.Nested.Inner + * @param {string} space - spaaaaaaaaace + * @param {string} peace - peaaaaaaaaace + * @return {string | number} + */ +var x = 1; +/** @type {NS.Nested.Inner} */ +function f(space, peace) { + return '1' +} diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateClass.ts b/tests/cases/conformance/jsdoc/jsdocTemplateClass.ts index 5cd0cde89be..b13303d6def 100644 --- a/tests/cases/conformance/jsdoc/jsdocTemplateClass.ts +++ b/tests/cases/conformance/jsdoc/jsdocTemplateClass.ts @@ -7,6 +7,7 @@ * @template {T} * @typedef {(t: T) => T} Id */ +/** @template T */ class Foo { /** @typedef {(t: T) => T} Id2 */ /** @param {T} x */ @@ -16,7 +17,7 @@ class Foo { /** * * @param {T} x - * @param {Id} y + * @param {Id} y * @param {Id2} alpha * @return {T} */ diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction.ts b/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction.ts index dc44afe040a..a2a7a48c1cb 100644 --- a/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction.ts +++ b/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction.ts @@ -4,9 +4,12 @@ // @Filename: templateTagOnConstructorFunctions.js /** - * @template {T} - * @typedef {(t: T) => T} Id + * @template {U} + * @typedef {(u: U) => U} Id + */ +/** * @param {T} t + * @template {T} */ function Zet(t) { /** @type {T} */ @@ -15,7 +18,7 @@ function Zet(t) { } /** * @param {T} v - * @param {Id} id + * @param {Id} id */ Zet.prototype.add = function(v, id) { this.u = v || this.t diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction2.ts b/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction2.ts index a4f107190ff..c736962de39 100644 --- a/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction2.ts +++ b/tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction2.ts @@ -4,8 +4,8 @@ // @Filename: templateTagWithNestedTypeLiteral.js /** - * @template {T} * @param {T} t + * @template {T} */ function Zet(t) { /** @type {T} */ diff --git a/tests/cases/conformance/jsdoc/jsdocTemplateTag2.ts b/tests/cases/conformance/jsdoc/jsdocTemplateTag2.ts new file mode 100644 index 00000000000..b7e706f124a --- /dev/null +++ b/tests/cases/conformance/jsdoc/jsdocTemplateTag2.ts @@ -0,0 +1,16 @@ +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @lib: dom,esnext +// @Filename: github17339.js + +var obj = { + /** + * @template T + * @param {T} a + * @returns {T} + */ + x: function (a) { + return a; + }, +}; diff --git a/tests/cases/fourslash/jsQuickInfoGenerallyAcceptableSize.ts b/tests/cases/fourslash/jsQuickInfoGenerallyAcceptableSize.ts index a6fa8059481..8a76a47dc8a 100644 --- a/tests/cases/fourslash/jsQuickInfoGenerallyAcceptableSize.ts +++ b/tests/cases/fourslash/jsQuickInfoGenerallyAcceptableSize.ts @@ -6,7 +6,7 @@ ////// Data table /////** //// @typedef DataTableThing -//// @type {Thing} +//// @type {Object} //// @property {function(TagCollection, Location, string, string, Infotable):void} AddDataTableEntries - (arg0: tags, arg1: location, arg2: source, arg3: sourceType, arg4: values) Add multiple data table entries. //// @property {function(TagCollection, Location, string, string, Infotable):string} AddDataTableEntry - (arg0: tags, arg1: location, arg2: source, arg3: sourceType, arg4: values) Add a new data table entry. //// @property {function(TagCollection, Location, string, string, Infotable):void} AddOrUpdateDataTableEntries - (arg0: tags, arg1: location, arg2: source, arg3: sourceType, arg4: values) Add or update multiple data table entries. @@ -206,7 +206,7 @@ //// * Another thing //// * @type {SomeCallback} //// */ -////var another/*2*/Thing = function(a, b) {} +////var anotherThing/*2*/ = function(a, b) {} verify.quickInfoAt("1", "var doSomething: (dataTable: DataTableThing) => void", "Do something"); -verify.quickInfoAt("2", "var anotherThing: any", "Another thing"); // TODO: #23947 +verify.quickInfoAt("2", "var anotherThing: SomeCallback", "Another thing"); diff --git a/tests/cases/fourslash/server/jsdocCallbackTag.ts b/tests/cases/fourslash/server/jsdocCallbackTag.ts new file mode 100644 index 00000000000..700419cd682 --- /dev/null +++ b/tests/cases/fourslash/server/jsdocCallbackTag.ts @@ -0,0 +1,54 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: jsdocCallbackTag.js +//// /** +//// * @callback FooHandler - A kind of magic +//// * @param {string} eventName - So many words +//// * @param eventName2 {number | string} - Silence is golden +//// * @param eventName3 - Osterreich mos def +//// * @return {number} - DIVEKICK +//// */ +//// /** +//// * @type {FooHa/*8*/ndler} callback +//// */ +//// var t/*1*/; +//// +//// /** +//// * @callback FooHandler2 - What, another one? +//// * @param {string=} eventName - it keeps happening +//// * @param {string} [eventName2] - i WARNED you dog +//// */ +//// /** +//// * @type {FooH/*3*/andler2} callback +//// */ +//// var t2/*2*/; +//// t(/*4*/"!", /*5*/12, /*6*/false); + +goTo.marker("1"); +verify.quickInfoIs("var t: FooHandler"); +goTo.marker("2"); +verify.quickInfoIs("var t2: FooHandler2"); +goTo.marker("3"); +verify.quickInfoIs("type FooHandler2 = (eventName?: string, eventName2?: string) => any", "- What, another one?"); +goTo.marker("8"); +verify.quickInfoIs("type FooHandler = (eventName: string, eventName2: string | number, eventName3: any) => number", "- A kind of magic"); +verify.signatureHelp({ + marker: '4', + text: "t(eventName: string, eventName2: string | number, eventName3: any): number", + parameterDocComment: "- So many words", + tags: [{ name: "callback", text: "FooHandler - A kind of magic" }, + { name: "type", text: "{FooHandler} callback" }] +}); +verify.signatureHelp({ + marker: '5', + parameterDocComment: "- Silence is golden", + tags: [{ name: "callback", text: "FooHandler - A kind of magic" }, + { name: "type", text: "{FooHandler} callback" }] +}); +verify.signatureHelp({ + marker: '6', + parameterDocComment: "- Osterreich mos def", + tags: [{ name: "callback", text: "FooHandler - A kind of magic" }, + { name: "type", text: "{FooHandler} callback" }] +}); diff --git a/tests/cases/fourslash/server/jsdocCallbackTagNavigateTo.ts b/tests/cases/fourslash/server/jsdocCallbackTagNavigateTo.ts new file mode 100644 index 00000000000..2beaf99ed70 --- /dev/null +++ b/tests/cases/fourslash/server/jsdocCallbackTagNavigateTo.ts @@ -0,0 +1,33 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: jsDocCallback.js + +//// /** +//// * @callback FooCallback +//// * @param {string} eventName - What even is the navigation bar? +//// */ +//// /** @type {FooCallback} */ +//// var t; + +verify.navigationBar([ + { + "text": "", + "kind": "script", + "childItems": [ + { + "text": "FooCallback", + "kind": "type" + }, + { + "text": "t", + "kind": "var" + } + ] + }, + { + "text": "FooCallback", + "kind": "type", + "indent": 1 + } +]) diff --git a/tests/cases/fourslash/server/jsdocCallbackTagRename01.ts b/tests/cases/fourslash/server/jsdocCallbackTagRename01.ts new file mode 100644 index 00000000000..bb7dd32cfc2 --- /dev/null +++ b/tests/cases/fourslash/server/jsdocCallbackTagRename01.ts @@ -0,0 +1,15 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: jsDocCallback.js +//// +//// /** +//// * @callback [|FooCallback|] +//// * @param {string} eventName - Rename should work +//// */ +//// +//// /** @type {/*1*/[|FooCallback|]} */ +//// var t; + +const ranges = test.ranges(); +verify.renameLocations(ranges[0], { findInStrings: false, findInComments: true, ranges }); diff --git a/tests/cases/fourslash/server/jsdocTypedefTag.ts b/tests/cases/fourslash/server/jsdocTypedefTag.ts index 9e980114835..1ab70604561 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTag.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTag.ts @@ -6,7 +6,7 @@ //// /** @typedef {(string | number)} NumberLike */ //// //// /** -//// * @typedef Animal +//// * @typedef Animal - think Giraffes //// * @type {Object} //// * @property {string} animalName //// * @property {number} animalAge @@ -36,7 +36,7 @@ //// p.personName./*personName*/; //// p.personAge./*personAge*/; //// -//// /** @type {Animal} */ +//// /** @type {/*AnimalType*/Animal} */ //// var a;a./*animal*/; //// a.animalName./*animalName*/; //// a.animalAge./*animalAge*/; @@ -85,4 +85,7 @@ verify.completionListContains('catAge'); goTo.marker('catName'); verify.completionListContains('charAt'); goTo.marker('catAge'); -verify.completionListContains('toExponential'); \ No newline at end of file +verify.completionListContains('toExponential'); + +goTo.marker("AnimalType"); +verify.quickInfoIs("type Animal = {\n animalName: string;\n animalAge: number;\n}", "- think Giraffes"); From 176e35b9c3482e8bff4fbf25929b2cbbd58f4295 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 17 May 2018 09:54:47 -0700 Subject: [PATCH 12/30] moveToNewFile: Don't move imports (#24177) --- src/compiler/core.ts | 17 +++++ src/services/codefixes/fixUnreachableCode.ts | 15 +---- src/services/refactors/moveToNewFile.ts | 64 +++++++++++++++---- .../fourslash/moveToNewFile_exportImport.ts | 8 +-- .../fourslash/moveToNewFile_moveImport.ts | 5 +- 5 files changed, 76 insertions(+), 33 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 3e8e33e3017..fb4324eb0a4 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -696,6 +696,23 @@ namespace ts { return false; } + /** Calls the callback with (start, afterEnd) index pairs for each range where 'pred' is true. */ + export function getRangesWhere(arr: ReadonlyArray, pred: (t: T) => boolean, cb: (start: number, afterEnd: number) => void): void { + let start: number | undefined; + for (let i = 0; i < arr.length; i++) { + if (pred(arr[i])) { + start = start === undefined ? i : start; + } + else { + if (start !== undefined) { + cb(start, i); + start = undefined; + } + } + } + if (start !== undefined) cb(start, arr.length); + } + export function concatenate(array1: T[], array2: T[]): T[]; export function concatenate(array1: ReadonlyArray, array2: ReadonlyArray): ReadonlyArray; export function concatenate(array1: T[], array2: T[]): T[] { diff --git a/src/services/codefixes/fixUnreachableCode.ts b/src/services/codefixes/fixUnreachableCode.ts index 5b075d6af1f..96241c2263c 100644 --- a/src/services/codefixes/fixUnreachableCode.ts +++ b/src/services/codefixes/fixUnreachableCode.ts @@ -71,19 +71,6 @@ namespace ts.codefix { // Calls 'cb' with the start and end of each range where 'pred' is true. function split(arr: ReadonlyArray, pred: (t: T) => boolean, cb: (start: T, end: T) => void): void { - let start: T | undefined; - for (let i = 0; i < arr.length; i++) { - const value = arr[i]; - if (pred(value)) { - start = start || value; - } - else { - if (start) { - cb(start, arr[i - 1]); - start = undefined; - } - } - } - if (start) cb(start, arr[arr.length - 1]); + getRangesWhere(arr, pred, (start, afterEnd) => cb(arr[start], arr[afterEnd - 1])); } } diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 2f5a27f87f7..621bf4eda2d 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -3,7 +3,7 @@ namespace ts.refactor { const refactorName = "Move to a new file"; registerRefactor(refactorName, { getAvailableActions(context): ApplicableRefactorInfo[] { - if (!context.preferences.allowTextChangesInNewFiles || getStatementsToMove(context) === undefined) return undefined; + if (!context.preferences.allowTextChangesInNewFiles || getFirstAndLastStatementToMove(context) === undefined) return undefined; const description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file); return [{ name: refactorName, description, actions: [{ name: refactorName, description }] }]; }, @@ -15,7 +15,7 @@ namespace ts.refactor { } }); - function getStatementsToMove(context: RefactorContext): ReadonlyArray | undefined { + function getFirstAndLastStatementToMove(context: RefactorContext): { readonly first: number, readonly afterLast: number } | undefined { const { file } = context; const range = createTextRangeFromSpan(getRefactorContextSpan(context)); const { statements } = file; @@ -28,12 +28,12 @@ namespace ts.refactor { // Can't be partially into the next node if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end)) return undefined; - return statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex); + return { first: startNodeIndex, afterLast: afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex }; } - function doChange(oldFile: SourceFile, program: Program, toMove: ReadonlyArray, changes: textChanges.ChangeTracker, host: LanguageServiceHost): void { + function doChange(oldFile: SourceFile, program: Program, toMove: ToMove, changes: textChanges.ChangeTracker, host: LanguageServiceHost): void { const checker = program.getTypeChecker(); - const usage = getUsageInfo(oldFile, toMove, checker); + const usage = getUsageInfo(oldFile, toMove.all, checker); const currentDirectory = getDirectoryPath(oldFile.fileName); const extension = extensionFromPath(oldFile.fileName); @@ -46,6 +46,42 @@ namespace ts.refactor { addNewFileToTsconfig(program, changes, oldFile.fileName, newFileNameWithExtension, hostGetCanonicalFileName(host)); } + interface StatementRange { + readonly first: Statement; + readonly last: Statement; + } + interface ToMove { + readonly all: ReadonlyArray; + readonly ranges: ReadonlyArray; + } + + // Filters imports out of the range of statements to move. Imports will be copied to the new file anyway, and may still be needed in the old file. + function getStatementsToMove(context: RefactorContext): ToMove | undefined { + const { statements } = context.file; + const { first, afterLast } = getFirstAndLastStatementToMove(context)!; + const all: Statement[] = []; + const ranges: StatementRange[] = []; + const rangeToMove = statements.slice(first, afterLast); + getRangesWhere(rangeToMove, s => !isPureImport(s), (start, afterEnd) => { + for (let i = start; i < afterEnd; i++) all.push(rangeToMove[i]); + ranges.push({ first: rangeToMove[start], last: rangeToMove[afterEnd - 1] }); + }); + return { all, ranges }; + } + + function isPureImport(node: Node): boolean { + switch (node.kind) { + case SyntaxKind.ImportDeclaration: + return true; + case SyntaxKind.ImportEqualsDeclaration: + return !hasModifier(node, ModifierFlags.Export); + case SyntaxKind.VariableStatement: + return (node as VariableStatement).declarationList.declarations.every(d => isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true)); + default: + return false; + } + } + function addNewFileToTsconfig(program: Program, changes: textChanges.ChangeTracker, oldFileName: string, newFileNameWithExtension: string, getCanonicalFileName: GetCanonicalFileName): void { const cfg = program.getCompilerOptions().configFile; if (!cfg) return; @@ -62,13 +98,13 @@ namespace ts.refactor { } function getNewStatements( - oldFile: SourceFile, usage: UsageInfo, changes: textChanges.ChangeTracker, toMove: ReadonlyArray, program: Program, newModuleName: string, + oldFile: SourceFile, usage: UsageInfo, changes: textChanges.ChangeTracker, toMove: ToMove, program: Program, newModuleName: string, ): ReadonlyArray { const checker = program.getTypeChecker(); if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { - changes.deleteNodeRange(oldFile, first(toMove), last(toMove)); - return toMove; + deleteMovedStatements(oldFile, toMove.ranges, changes); + return toMove.all; } const useEs6ModuleSyntax = !!oldFile.externalModuleIndicator; @@ -77,17 +113,23 @@ namespace ts.refactor { changes.insertNodeBefore(oldFile, oldFile.statements[0], importsFromNewFile, /*blankLineBetween*/ true); } - deleteUnusedOldImports(oldFile, toMove, changes, usage.unusedImportsFromOldFile, checker); - changes.deleteNodeRange(oldFile, first(toMove), last(toMove)); + deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker); + deleteMovedStatements(oldFile, toMove.ranges, changes); updateImportsInOtherFiles(changes, program, oldFile, usage.movedSymbols, newModuleName); return [ ...getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, useEs6ModuleSyntax), - ...addExports(oldFile, toMove, usage.oldFileImportsFromNewFile, useEs6ModuleSyntax), + ...addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEs6ModuleSyntax), ]; } + function deleteMovedStatements(sourceFile: SourceFile, moved: ReadonlyArray, changes: textChanges.ChangeTracker) { + for (const { first, last } of moved) { + changes.deleteNodeRange(sourceFile, first, last); + } + } + function deleteUnusedOldImports(oldFile: SourceFile, toMove: ReadonlyArray, changes: textChanges.ChangeTracker, toDelete: ReadonlySymbolSet, checker: TypeChecker) { for (const statement of oldFile.statements) { if (contains(toMove, statement)) continue; diff --git a/tests/cases/fourslash/moveToNewFile_exportImport.ts b/tests/cases/fourslash/moveToNewFile_exportImport.ts index a8ac3a66a01..657aa2f8075 100644 --- a/tests/cases/fourslash/moveToNewFile_exportImport.ts +++ b/tests/cases/fourslash/moveToNewFile_exportImport.ts @@ -9,14 +9,12 @@ verify.moveToNewFile({ newFileContents: { "/a.ts": -`import { M } from "./M"; - -export namespace N { export const x = 0; } +`export namespace N { export const x = 0; } +import M = N; M;`, - "/M.ts": + "/O.ts": `import { N } from "./a"; -export import M = N; export import O = N;`, }, }); diff --git a/tests/cases/fourslash/moveToNewFile_moveImport.ts b/tests/cases/fourslash/moveToNewFile_moveImport.ts index a96a187f633..08a89403070 100644 --- a/tests/cases/fourslash/moveToNewFile_moveImport.ts +++ b/tests/cases/fourslash/moveToNewFile_moveImport.ts @@ -5,14 +5,13 @@ ////a;|] ////b; -//verify.noMoveToNewFile(); verify.moveToNewFile({ newFileContents: { "/a.ts": -`b;`, +`import { b } from "m"; +b;`, "/newFile.ts": `import { a } from "m"; -import { a, b } from "m"; a;`, } }); From 2b5ff29254add32c7d5827b9131a69001b8f1615 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 17 May 2018 10:02:10 -0700 Subject: [PATCH 13/30] Reduce map lookups (#24203) --- 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 4c9a98951fa..01e7beb6ef8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15397,10 +15397,11 @@ namespace ts { links.resolvedSignatures = createMap(); } const cacheKey = "" + getTypeId(valueType); - if (links.resolvedSignatures.get(cacheKey) && links.resolvedSignatures.get(cacheKey) !== resolvingSignaturesArray) { - signatures = links.resolvedSignatures.get(cacheKey); + const cachedResolved = links.resolvedSignatures.get(cacheKey); + if (cachedResolved && cachedResolved !== resolvingSignaturesArray) { + signatures = cachedResolved; } - else if (!links.resolvedSignatures.get(cacheKey)) { + else if (!cachedResolved) { links.resolvedSignatures.set(cacheKey, resolvingSignaturesArray); links.resolvedSignatures.set(cacheKey, signatures = instantiateJsxSignatures(context, signatures)); } From 64504908449d39e34272d979537052f0cf52302f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 17 May 2018 10:46:10 -0700 Subject: [PATCH 14/30] Fix jsdoc type resolution [merge to master] (#24204) * Fix JSDoc type resolution Breaks type parameter resolution that is looked up through prototype methods, though. I need to fix that still. * Check for prototype method assignments first * Undo dedupe changes to getJSDocTags * JS Type aliases can't refer to host type params Previously, js type aliases (@typedef and @callback) could refer to type paremeters defined in @template tags in a *different* jsdoc tag, as long as both tags were hosted on the same signature. * Reduce dedupe changes+update baseline The only reason I had undone them was to merge successfully with an older state of master. --- src/compiler/checker.ts | 45 ++++++++++++++----- src/compiler/utilities.ts | 10 +++-- .../reference/paramTagTypeResolution.symbols | 23 ++++++++++ .../reference/paramTagTypeResolution.types | 31 +++++++++++++ .../typedefTagTypeResolution.errors.txt | 37 +++++++++++++++ .../typedefTagTypeResolution.symbols | 38 ++++++++++++++++ .../reference/typedefTagTypeResolution.types | 40 +++++++++++++++++ .../jsdoc/paramTagTypeResolution.ts | 13 ++++++ .../jsdoc/typedefTagTypeResolution.ts | 32 +++++++++++++ 9 files changed, 253 insertions(+), 16 deletions(-) create mode 100644 tests/baselines/reference/paramTagTypeResolution.symbols create mode 100644 tests/baselines/reference/paramTagTypeResolution.types create mode 100644 tests/baselines/reference/typedefTagTypeResolution.errors.txt create mode 100644 tests/baselines/reference/typedefTagTypeResolution.symbols create mode 100644 tests/baselines/reference/typedefTagTypeResolution.types create mode 100644 tests/cases/conformance/jsdoc/paramTagTypeResolution.ts create mode 100644 tests/cases/conformance/jsdoc/typedefTagTypeResolution.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 01e7beb6ef8..ef341211c54 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1453,6 +1453,12 @@ namespace ts { location = location.parent; } break; + case SyntaxKind.JSDocTypedefTag: + case SyntaxKind.JSDocCallbackTag: + // js type aliases do not resolve names from their host, so skip past it + lastLocation = location; + location = getJSDocHost(location).parent; + continue; } if (isSelfReferenceLocation(location)) { lastSelfReferenceLocation = location; @@ -2153,25 +2159,31 @@ namespace ts { */ function resolveEntityNameFromJSSpecialAssignment(name: Identifier, meaning: SymbolFlags) { if (isJSDocTypeReference(name.parent)) { - const host = getJSDocHost(name.parent); - if (host) { - const secondaryLocation = getJSSpecialAssignmentSymbol(getJSDocHost(name.parent.parent.parent as JSDocTag)); - return secondaryLocation && resolveName(secondaryLocation, name.escapedText, meaning, /*nameNotFoundMessage*/ undefined, name, /*isUse*/ true); + const secondaryLocation = getJSSpecialAssignmentLocation(name.parent); + if (secondaryLocation) { + return resolveName(secondaryLocation, name.escapedText, meaning, /*nameNotFoundMessage*/ undefined, name, /*isUse*/ true); } } } - function getJSSpecialAssignmentSymbol(host: HasJSDoc): Declaration | undefined { - if (isPropertyAssignment(host) && isFunctionLike(host.initializer)) { - const symbol = getSymbolOfNode(host.initializer); - return symbol && symbol.valueDeclaration; + function getJSSpecialAssignmentLocation(node: TypeReferenceNode): Declaration | undefined { + const typeAlias = findAncestor(node, node => !(isJSDocNode(node) || node.flags & NodeFlags.JSDoc) ? "quit" : isJSDocTypeAlias(node)); + if (typeAlias) { + return; } - else if (isExpressionStatement(host) && - isBinaryExpression(host.expression) && - getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) { + const host = getJSDocHost(node); + if (host && + isExpressionStatement(host) && + isBinaryExpression(host.expression) && + getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) { const symbol = getSymbolOfNode(host.expression.left); return symbol && symbol.parent.valueDeclaration; } + const sig = getHostSignatureFromJSDocHost(host); + if (sig) { + const symbol = getSymbolOfNode(sig); + return symbol && symbol.valueDeclaration; + } } function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol { @@ -9554,7 +9566,16 @@ namespace ts { // parameters that are in scope (and therefore potentially referenced). For type literals that // aren't the right hand side of a generic type alias declaration we optimize by reducing the // set of type parameters to those that are possibly referenced in the literal. - const declaration = symbol.declarations[0]; + let declaration = symbol.declarations[0]; + if (isInJavaScriptFile(declaration)) { + const paramTag = findAncestor(declaration, isJSDocParameterTag); + if (paramTag) { + const paramSymbol = getParameterSymbolFromJSDoc(paramTag); + if (paramSymbol) { + declaration = paramSymbol.valueDeclaration; + } + } + } let outerTypeParameters = getOuterTypeParameters(declaration, /*includeThisTypes*/ true); if (isJavaScriptConstructor(declaration)) { const templateTagParameters = getTypeParametersFromDeclaration(declaration as DeclarationWithTypeParameters); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7339907547a..6e440e01ecf 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1865,8 +1865,7 @@ namespace ts { // * @returns {number} // */ // var x = function(name) { return name.length; } - if (parent.parent && - (getSingleVariableOfVariableStatement(parent.parent) === node)) { + if (parent.parent && (getSingleVariableOfVariableStatement(parent.parent) === node)) { getJSDocCommentsAndTagsWorker(parent.parent); } if (parent.parent && parent.parent.parent && @@ -1913,8 +1912,11 @@ namespace ts { return parameter && parameter.symbol; } - export function getHostSignatureFromJSDoc(node: JSDocTag): SignatureDeclaration | undefined { - const host = getJSDocHost(node); + export function getHostSignatureFromJSDoc(node: Node): SignatureDeclaration | undefined { + return getHostSignatureFromJSDocHost(getJSDocHost(node)); + } + + export function getHostSignatureFromJSDocHost(host: HasJSDoc): SignatureDeclaration | undefined { const decl = getSourceOfDefaultedAssignment(host) || getSourceOfAssignment(host) || getSingleInitializerOfVariableStatementOrPropertyDeclaration(host) || diff --git a/tests/baselines/reference/paramTagTypeResolution.symbols b/tests/baselines/reference/paramTagTypeResolution.symbols new file mode 100644 index 00000000000..1584e2fcb95 --- /dev/null +++ b/tests/baselines/reference/paramTagTypeResolution.symbols @@ -0,0 +1,23 @@ +=== tests/cases/conformance/jsdoc/main.js === +var f = require('./first'); +>f : Symbol(f, Decl(main.js, 0, 3)) +>require : Symbol(require) +>'./first' : Symbol("tests/cases/conformance/jsdoc/first", Decl(first.js, 0, 0)) + +f(1, n => { }) +>f : Symbol(f, Decl(main.js, 0, 3)) +>n : Symbol(n, Decl(main.js, 1, 4)) + +=== tests/cases/conformance/jsdoc/first.js === +/** @template T + * @param {T} x + * @param {(t: T) => void} k + */ +module.exports = function (x, k) { return k(x) } +>module : Symbol(export=, Decl(first.js, 0, 0)) +>exports : Symbol(export=, Decl(first.js, 0, 0)) +>x : Symbol(x, Decl(first.js, 4, 27)) +>k : Symbol(k, Decl(first.js, 4, 29)) +>k : Symbol(k, Decl(first.js, 4, 29)) +>x : Symbol(x, Decl(first.js, 4, 27)) + diff --git a/tests/baselines/reference/paramTagTypeResolution.types b/tests/baselines/reference/paramTagTypeResolution.types new file mode 100644 index 00000000000..daf7749c6bb --- /dev/null +++ b/tests/baselines/reference/paramTagTypeResolution.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/jsdoc/main.js === +var f = require('./first'); +>f : (x: T, k: (t: T) => void) => void +>require('./first') : (x: T, k: (t: T) => void) => void +>require : any +>'./first' : "./first" + +f(1, n => { }) +>f(1, n => { }) : void +>f : (x: T, k: (t: T) => void) => void +>1 : 1 +>n => { } : (n: number) => void +>n : number + +=== tests/cases/conformance/jsdoc/first.js === +/** @template T + * @param {T} x + * @param {(t: T) => void} k + */ +module.exports = function (x, k) { return k(x) } +>module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void +>module.exports : any +>module : any +>exports : any +>function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void +>x : T +>k : (t: T) => void +>k(x) : void +>k : (t: T) => void +>x : T + diff --git a/tests/baselines/reference/typedefTagTypeResolution.errors.txt b/tests/baselines/reference/typedefTagTypeResolution.errors.txt new file mode 100644 index 00000000000..8d8c324beb3 --- /dev/null +++ b/tests/baselines/reference/typedefTagTypeResolution.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/jsdoc/github20832.js(2,15): error TS2304: Cannot find name 'U'. +tests/cases/conformance/jsdoc/github20832.js(17,12): error TS2304: Cannot find name 'V'. + + +==== tests/cases/conformance/jsdoc/github20832.js (2 errors) ==== + // #20832 + /** @typedef {U} T - should be "error, can't find type named 'U' */ + ~ +!!! error TS2304: Cannot find name 'U'. + /** + * @template U + * @param {U} x + * @return {T} + */ + function f(x) { + return x; + } + + /** @type T - should be fine, since T will be any */ + const x = 3; + + /** + * @callback Cb + * @param {V} firstParam + ~ +!!! error TS2304: Cannot find name 'V'. + */ + /** + * @template V + * @param {V} vvvvv + */ + function g(vvvvv) { + } + + /** @type {Cb} */ + const cb = x => {} + \ No newline at end of file diff --git a/tests/baselines/reference/typedefTagTypeResolution.symbols b/tests/baselines/reference/typedefTagTypeResolution.symbols new file mode 100644 index 00000000000..9201ecb2cd8 --- /dev/null +++ b/tests/baselines/reference/typedefTagTypeResolution.symbols @@ -0,0 +1,38 @@ +=== tests/cases/conformance/jsdoc/github20832.js === +// #20832 +/** @typedef {U} T - should be "error, can't find type named 'U' */ +/** + * @template U + * @param {U} x + * @return {T} + */ +function f(x) { +>f : Symbol(f, Decl(github20832.js, 0, 0)) +>x : Symbol(x, Decl(github20832.js, 7, 11)) + + return x; +>x : Symbol(x, Decl(github20832.js, 7, 11)) +} + +/** @type T - should be fine, since T will be any */ +const x = 3; +>x : Symbol(x, Decl(github20832.js, 12, 5)) + +/** + * @callback Cb + * @param {V} firstParam + */ +/** + * @template V + * @param {V} vvvvv + */ +function g(vvvvv) { +>g : Symbol(g, Decl(github20832.js, 12, 12)) +>vvvvv : Symbol(vvvvv, Decl(github20832.js, 22, 11)) +} + +/** @type {Cb} */ +const cb = x => {} +>cb : Symbol(cb, Decl(github20832.js, 26, 5)) +>x : Symbol(x, Decl(github20832.js, 26, 10)) + diff --git a/tests/baselines/reference/typedefTagTypeResolution.types b/tests/baselines/reference/typedefTagTypeResolution.types new file mode 100644 index 00000000000..20c94128326 --- /dev/null +++ b/tests/baselines/reference/typedefTagTypeResolution.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/jsdoc/github20832.js === +// #20832 +/** @typedef {U} T - should be "error, can't find type named 'U' */ +/** + * @template U + * @param {U} x + * @return {T} + */ +function f(x) { +>f : (x: U) => any +>x : U + + return x; +>x : U +} + +/** @type T - should be fine, since T will be any */ +const x = 3; +>x : any +>3 : 3 + +/** + * @callback Cb + * @param {V} firstParam + */ +/** + * @template V + * @param {V} vvvvv + */ +function g(vvvvv) { +>g : (vvvvv: V) => void +>vvvvv : V +} + +/** @type {Cb} */ +const cb = x => {} +>cb : Cb +>x => {} : (x: any) => void +>x : any + diff --git a/tests/cases/conformance/jsdoc/paramTagTypeResolution.ts b/tests/cases/conformance/jsdoc/paramTagTypeResolution.ts new file mode 100644 index 00000000000..0256651234d --- /dev/null +++ b/tests/cases/conformance/jsdoc/paramTagTypeResolution.ts @@ -0,0 +1,13 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: first.js +/** @template T + * @param {T} x + * @param {(t: T) => void} k + */ +module.exports = function (x, k) { return k(x) } + +// @Filename: main.js +var f = require('./first'); +f(1, n => { }) diff --git a/tests/cases/conformance/jsdoc/typedefTagTypeResolution.ts b/tests/cases/conformance/jsdoc/typedefTagTypeResolution.ts new file mode 100644 index 00000000000..c4c993d9c78 --- /dev/null +++ b/tests/cases/conformance/jsdoc/typedefTagTypeResolution.ts @@ -0,0 +1,32 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: github20832.js + +// #20832 +/** @typedef {U} T - should be "error, can't find type named 'U' */ +/** + * @template U + * @param {U} x + * @return {T} + */ +function f(x) { + return x; +} + +/** @type T - should be fine, since T will be any */ +const x = 3; + +/** + * @callback Cb + * @param {V} firstParam + */ +/** + * @template V + * @param {V} vvvvv + */ +function g(vvvvv) { +} + +/** @type {Cb} */ +const cb = x => {} From 8dc9b76b6d22eb400e23b35adbb67321e166ca71 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 17 May 2018 11:45:34 -0700 Subject: [PATCH 15/30] Add undefined guard --- src/compiler/transformers/declarations.ts | 18 ++++---- ...eclarationFilesGeneratingTypeReferences.js | 46 +++++++++++++++++++ ...ationFilesGeneratingTypeReferences.symbols | 15 ++++++ ...arationFilesGeneratingTypeReferences.types | 15 ++++++ ...eclarationFilesGeneratingTypeReferences.ts | 13 ++++++ 5 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 tests/baselines/reference/declarationFilesGeneratingTypeReferences.js create mode 100644 tests/baselines/reference/declarationFilesGeneratingTypeReferences.symbols create mode 100644 tests/baselines/reference/declarationFilesGeneratingTypeReferences.types create mode 100644 tests/cases/compiler/declarationFilesGeneratingTypeReferences.ts diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 1a404d8262a..b0191123591 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -217,16 +217,18 @@ namespace ts { function getFileReferenceForTypeName(typeName: string): FileReference | undefined { // Elide type references for which we have imports - for (const importStatement of emittedImports) { - if (isImportEqualsDeclaration(importStatement) && isExternalModuleReference(importStatement.moduleReference)) { - const expr = importStatement.moduleReference.expression; - if (isStringLiteralLike(expr) && expr.text === typeName) { + if (emittedImports) { + for (const importStatement of emittedImports) { + if (isImportEqualsDeclaration(importStatement) && isExternalModuleReference(importStatement.moduleReference)) { + const expr = importStatement.moduleReference.expression; + if (isStringLiteralLike(expr) && expr.text === typeName) { + return undefined; + } + } + else if (isImportDeclaration(importStatement) && isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { return undefined; } } - else if (isImportDeclaration(importStatement) && isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) { - return undefined; - } } return { fileName: typeName, pos: -1, end: -1 }; } @@ -1325,4 +1327,4 @@ namespace ts { } return false; } -} \ No newline at end of file +} diff --git a/tests/baselines/reference/declarationFilesGeneratingTypeReferences.js b/tests/baselines/reference/declarationFilesGeneratingTypeReferences.js new file mode 100644 index 00000000000..f928b064667 --- /dev/null +++ b/tests/baselines/reference/declarationFilesGeneratingTypeReferences.js @@ -0,0 +1,46 @@ +//// [tests/cases/compiler/declarationFilesGeneratingTypeReferences.ts] //// + +//// [index.d.ts] +interface JQuery { + +} + +//// [app.ts] +/// +namespace Test { + export var x: JQuery; +} + +//// [out.js] +/// +var Test; +(function (Test) { +})(Test || (Test = {})); + + +//// [out.d.ts] +/// +declare namespace Test { + var x: JQuery; +} + + +//// [DtsFileErrors] + + +out.d.ts(1,23): error TS2688: Cannot find type definition file for 'jquery'. + + +==== /a/node_modules/@types/jquery/index.d.ts (0 errors) ==== + interface JQuery { + + } + +==== out.d.ts (1 errors) ==== + /// + ~~~~~~ +!!! error TS2688: Cannot find type definition file for 'jquery'. + declare namespace Test { + var x: JQuery; + } + \ No newline at end of file diff --git a/tests/baselines/reference/declarationFilesGeneratingTypeReferences.symbols b/tests/baselines/reference/declarationFilesGeneratingTypeReferences.symbols new file mode 100644 index 00000000000..28ae63fa4a9 --- /dev/null +++ b/tests/baselines/reference/declarationFilesGeneratingTypeReferences.symbols @@ -0,0 +1,15 @@ +=== /a/node_modules/@types/jquery/index.d.ts === +interface JQuery { +>JQuery : Symbol(JQuery, Decl(index.d.ts, 0, 0)) + +} + +=== /a/app.ts === +/// +namespace Test { +>Test : Symbol(Test, Decl(app.ts, 0, 0)) + + export var x: JQuery; +>x : Symbol(x, Decl(app.ts, 2, 14)) +>JQuery : Symbol(JQuery, Decl(index.d.ts, 0, 0)) +} diff --git a/tests/baselines/reference/declarationFilesGeneratingTypeReferences.types b/tests/baselines/reference/declarationFilesGeneratingTypeReferences.types new file mode 100644 index 00000000000..88c225f5d58 --- /dev/null +++ b/tests/baselines/reference/declarationFilesGeneratingTypeReferences.types @@ -0,0 +1,15 @@ +=== /a/node_modules/@types/jquery/index.d.ts === +interface JQuery { +>JQuery : JQuery + +} + +=== /a/app.ts === +/// +namespace Test { +>Test : typeof Test + + export var x: JQuery; +>x : JQuery +>JQuery : JQuery +} diff --git a/tests/cases/compiler/declarationFilesGeneratingTypeReferences.ts b/tests/cases/compiler/declarationFilesGeneratingTypeReferences.ts new file mode 100644 index 00000000000..0d27ad5918b --- /dev/null +++ b/tests/cases/compiler/declarationFilesGeneratingTypeReferences.ts @@ -0,0 +1,13 @@ +// @declaration: true +// @outFile: out.js + +// @filename: /a/node_modules/@types/jquery/index.d.ts +interface JQuery { + +} + +// @filename: /a/app.ts +/// +namespace Test { + export var x: JQuery; +} \ No newline at end of file From 09b9ec43e3963d18c14b3aff7e29e888f4fb0999 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 17 May 2018 12:38:20 -0700 Subject: [PATCH 16/30] moveToNewFile: Fix bug for VariableDeclaration missing initializer (#24214) --- src/services/refactors/moveToNewFile.ts | 2 +- ...le_variableDeclarationWithNoInitializer.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/moveToNewFile_variableDeclarationWithNoInitializer.ts diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 621bf4eda2d..3ec64171b17 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -433,7 +433,7 @@ namespace ts.refactor { } function isVariableDeclarationInImport(decl: VariableDeclaration) { return isSourceFile(decl.parent.parent.parent) && - isRequireCall(decl.initializer, /*checkArgumentIsStringLiteralLike*/ true); + decl.initializer && isRequireCall(decl.initializer, /*checkArgumentIsStringLiteralLike*/ true); } function filterImport(i: SupportedImport, moduleSpecifier: StringLiteralLike, keep: (name: Identifier) => boolean): SupportedImportStatement | undefined { diff --git a/tests/cases/fourslash/moveToNewFile_variableDeclarationWithNoInitializer.ts b/tests/cases/fourslash/moveToNewFile_variableDeclarationWithNoInitializer.ts new file mode 100644 index 00000000000..ef62f9b8d0f --- /dev/null +++ b/tests/cases/fourslash/moveToNewFile_variableDeclarationWithNoInitializer.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: /a.ts +////export {}; +////let x; +////[|const y = x;|] + +verify.moveToNewFile({ + newFileContents: { + "/a.ts": +`export {}; +export let x; +`, + + "/y.ts": +`import { x } from "./a"; +const y = x;`, + }, +}); From 3fc727b2564d1f03e63a671fbffe56368ea9320f Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 17 May 2018 13:08:22 -0700 Subject: [PATCH 17/30] Use import types to refer to declarations in declaration emit (#24071) * Stand up a simple implementation using import types for exports of modules which are otherwise inaccessible * Ensure references exist to link to modules containing utilized ambient modules * Accept baselines with new import type usage * Fix lint --- src/compiler/checker.ts | 153 ++++-- src/compiler/transformers/declarations.ts | 16 +- src/compiler/types.ts | 13 +- src/compiler/utilities.ts | 13 +- .../amdDeclarationEmitNoExtraDeclare.types | 4 +- .../reference/api/tsserverlibrary.d.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 1 + .../reference/augmentExportEquals5.types | 2 +- .../declarationEmitAliasFromIndirectFile.js | 21 +- ...declarationEmitAliasFromIndirectFile.types | 4 +- .../declarationEmitInferredTypeAlias7.js | 2 +- .../declarationEmitInferredTypeAlias7.types | 4 +- ...eclarationsForInferredTypeFromOtherFile.js | 48 ++ ...ationsForInferredTypeFromOtherFile.symbols | 22 + ...arationsForInferredTypeFromOtherFile.types | 25 + ...leMixinConditionalTypeBaseClassWorks.types | 28 +- .../reference/duplicatePackage.errors.txt | 4 +- .../reference/duplicatePackage.types | 14 +- ...ePackage_relativeImportWithinPackage.types | 8 +- ...e_relativeImportWithinPackage_scoped.types | 8 +- .../baselines/reference/es5ExportEquals.types | 2 +- .../baselines/reference/es6ExportEquals.types | 2 +- .../exportClassExtendingIntersection.js | 2 +- .../exportClassExtendingIntersection.types | 12 +- tests/baselines/reference/giant.types | 2 +- .../importCallExpression3ESNext.types | 4 +- ...tCallExpressionDeclarationEmit2.errors.txt | 10 - .../importCallExpressionDeclarationEmit2.js | 2 + .../importCallExpressionInAMD3.types | 4 +- .../importCallExpressionInCJS4.types | 4 +- .../importCallExpressionInSystem3.types | 4 +- .../importCallExpressionInUMD3.types | 4 +- ...mportShouldNotBeElidedInDeclarationEmit.js | 4 +- ...rtShouldNotBeElidedInDeclarationEmit.types | 8 +- tests/baselines/reference/localTypes5.types | 18 +- .../reference/mergedDeclarationExports.types | 2 +- .../reference/mixinClassesAnnotated.types | 2 +- .../reference/mixinClassesAnonymous.types | 38 +- ...moduleAugmentationImportsAndExports1.types | 6 +- ...moduleAugmentationImportsAndExports4.types | 6 +- ...moduleAugmentationImportsAndExports5.types | 6 +- ...moduleAugmentationImportsAndExports6.types | 6 +- .../moduleAugmentationInAmbientModule1.types | 6 +- .../moduleAugmentationInAmbientModule2.types | 6 +- .../moduleAugmentationInAmbientModule3.types | 12 +- .../moduleAugmentationInAmbientModule4.types | 12 +- .../moduleAugmentationInAmbientModule5.types | 6 +- .../moduleAugmentationsBundledOutput1.types | 12 +- .../moduleAugmentationsImports1.types | 12 +- .../moduleAugmentationsImports2.types | 12 +- .../moduleAugmentationsImports3.types | 12 +- .../moduleAugmentationsImports4.types | 12 +- .../moduleDuplicateIdentifiers.types | 2 +- ...onWithSymlinks_preserveSymlinks.errors.txt | 6 +- .../reference/multipleDefaultExports01.types | 2 +- .../reference/multipleDefaultExports03.types | 2 +- .../reference/multipleExportDefault3.types | 2 +- .../reference/multipleExportDefault5.types | 2 +- .../overrideBaseIntersectionMethod.types | 12 +- ...ivacyCannotNameAccessorDeclFile.errors.txt | 160 ------ .../privacyCannotNameAccessorDeclFile.js | 18 + .../privacyCannotNameAccessorDeclFile.types | 192 +++---- ...rivacyCannotNameVarTypeDeclFile.errors.txt | 135 ----- .../privacyCannotNameVarTypeDeclFile.js | 22 + .../privacyCannotNameVarTypeDeclFile.types | 256 ++++----- ...CannotNameParameterTypeDeclFile.errors.txt | 227 -------- ...FunctionCannotNameParameterTypeDeclFile.js | 38 ++ ...ctionCannotNameParameterTypeDeclFile.types | 512 +++++++++--------- ...ionCannotNameReturnTypeDeclFile.errors.txt | 198 ------- ...acyFunctionCannotNameReturnTypeDeclFile.js | 22 + ...FunctionCannotNameReturnTypeDeclFile.types | 256 ++++----- .../reference/privacyImportParseErrors.types | 2 +- .../typeFromParamTagForFunction.types | 16 +- .../reference/umd-augmentation-2.types | 20 +- .../reference/varRequireFromJavascript.types | 16 +- .../reference/varRequireFromTypescript.types | 20 +- ...eclarationsForInferredTypeFromOtherFile.ts | 12 + 77 files changed, 1154 insertions(+), 1637 deletions(-) create mode 100644 tests/baselines/reference/declarationsForInferredTypeFromOtherFile.js create mode 100644 tests/baselines/reference/declarationsForInferredTypeFromOtherFile.symbols create mode 100644 tests/baselines/reference/declarationsForInferredTypeFromOtherFile.types delete mode 100644 tests/baselines/reference/importCallExpressionDeclarationEmit2.errors.txt delete mode 100644 tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt delete mode 100644 tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt delete mode 100644 tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt delete mode 100644 tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt create mode 100644 tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ef341211c54..af308232eac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2794,6 +2794,14 @@ namespace ts { } return hasAccessibleDeclarations; } + else { + if (some(symbol.declarations, hasExternalModuleSymbol)) { + // Any meaning of a module symbol is always accessible via an `import` type + return { + accessibility: SymbolAccessibility.Accessible + }; + } + } // If we haven't got the accessible symbol, it doesn't mean the symbol is actually inaccessible. // It could be a qualified symbol and hence verify the path @@ -3164,9 +3172,9 @@ namespace ts { return createTypeReferenceNode(name, /*typeArguments*/ undefined); } if (!inTypeAlias && type.aliasSymbol && (context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) { - const name = symbolToTypeReferenceName(type.aliasSymbol); const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); - return createTypeReferenceNode(name, typeArgumentNodes); + if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & SymbolFlags.Class)) return createTypeReferenceNode(createIdentifier(""), typeArgumentNodes); + return symbolToTypeNode(type.aliasSymbol, context, SymbolFlags.Type, typeArgumentNodes); } if (type.flags & (TypeFlags.Union | TypeFlags.Intersection)) { const types = type.flags & TypeFlags.Union ? formatUnionTypes((type).types) : (type).types; @@ -3329,12 +3337,6 @@ namespace ts { return setEmitFlags(typeLiteralNode, (context.flags & NodeBuilderFlags.MultilineObjectLiterals) ? 0 : EmitFlags.SingleLine); } - function symbolToTypeReferenceName(symbol: Symbol) { - // Unnamed function expressions and arrow functions have reserved names that we don't want to display - const entityName = symbol.flags & SymbolFlags.Class || !isReservedMemberName(symbol.escapedName) ? symbolToName(symbol, context, SymbolFlags.Type, /*expectsIdentifier*/ false) : createIdentifier(""); - return entityName; - } - function typeReferenceToTypeNode(type: TypeReference) { const typeArguments: Type[] = type.typeArguments || emptyArray; if (type.target === globalArrayType) { @@ -3369,7 +3371,7 @@ namespace ts { else { const outerTypeParameters = type.target.outerTypeParameters; let i = 0; - let qualifiedName: QualifiedName | undefined; + let resultType: TypeReferenceNode | ImportTypeNode; if (outerTypeParameters) { const length = outerTypeParameters.length; while (i < length) { @@ -3383,64 +3385,66 @@ namespace ts { // the default outer type arguments), we don't show the group. if (!rangeEquals(outerTypeParameters, typeArguments, start, i)) { const typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context); - const typeArgumentNodes = typeArgumentSlice && createNodeArray(typeArgumentSlice); - const namePart = symbolToTypeReferenceName(parent); - (namePart.kind === SyntaxKind.Identifier ? namePart : namePart.right).typeArguments = typeArgumentNodes; - - if (qualifiedName) { - Debug.assert(!qualifiedName.right); - qualifiedName = addToQualifiedNameMissingRightIdentifier(qualifiedName, namePart); - qualifiedName = createQualifiedName(qualifiedName, /*right*/ undefined); - } - else { - qualifiedName = createQualifiedName(namePart, /*right*/ undefined); - } + const flags = context.flags; + context.flags |= NodeBuilderFlags.ForbidIndexedAccessSymbolReferences; + const ref = symbolToTypeNode(parent, context, SymbolFlags.Type, typeArgumentSlice) as TypeReferenceNode | ImportTypeNode; + context.flags = flags; + resultType = !resultType ? ref : appendReferenceToType(resultType, ref as TypeReferenceNode); } } } - - let entityName: EntityName; - const nameIdentifier = symbolToTypeReferenceName(type.symbol); - if (qualifiedName) { - Debug.assert(!qualifiedName.right); - qualifiedName = addToQualifiedNameMissingRightIdentifier(qualifiedName, nameIdentifier); - entityName = qualifiedName; - } - else { - entityName = nameIdentifier; - } - let typeArgumentNodes: ReadonlyArray | undefined; if (typeArguments.length > 0) { const typeParameterCount = (type.target.typeParameters || emptyArray).length; typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context); } - - if (typeArgumentNodes) { - const lastIdentifier = entityName.kind === SyntaxKind.Identifier ? entityName : entityName.right; - lastIdentifier.typeArguments = undefined; - } - - return createTypeReferenceNode(entityName, typeArgumentNodes); + const flags = context.flags; + context.flags |= NodeBuilderFlags.ForbidIndexedAccessSymbolReferences; + const finalRef = symbolToTypeNode(type.symbol, context, SymbolFlags.Type, typeArgumentNodes); + context.flags = flags; + return !resultType ? finalRef : appendReferenceToType(resultType, finalRef as TypeReferenceNode); } } - function addToQualifiedNameMissingRightIdentifier(left: QualifiedName, right: Identifier | QualifiedName) { - Debug.assert(left.right === undefined); - if (right.kind === SyntaxKind.Identifier) { - left.right = right; - return left; + function appendReferenceToType(root: TypeReferenceNode | ImportTypeNode, ref: TypeReferenceNode): TypeReferenceNode | ImportTypeNode { + if (isImportTypeNode(root)) { + // first shift type arguments + const innerParams = root.typeArguments; + if (root.qualifier) { + (isIdentifier(root.qualifier) ? root.qualifier : root.qualifier.right).typeArguments = innerParams; + } + root.typeArguments = ref.typeArguments; + // then move qualifiers + const ids = getAccessStack(ref); + for (const id of ids) { + root.qualifier = root.qualifier ? createQualifiedName(root.qualifier, id) : id; + } + return root; } - - let rightPart = right; - while (rightPart.left.kind !== SyntaxKind.Identifier) { - rightPart = rightPart.left; + else { + // first shift type arguments + const innerParams = root.typeArguments; + (isIdentifier(root.typeName) ? root.typeName : root.typeName.right).typeArguments = innerParams; + root.typeArguments = ref.typeArguments; + // then move qualifiers + const ids = getAccessStack(ref); + for (const id of ids) { + root.typeName = createQualifiedName(root.typeName, id); + } + return root; } + } - left.right = rightPart.left; - rightPart.left = left; - return right; + function getAccessStack(ref: TypeReferenceNode): Identifier[] { + let state = ref.typeName; + const ids = []; + while (!isIdentifier(state)) { + ids.unshift(state.right); + state = state.left; + } + ids.unshift(state); + return ids; } function createTypeNodesFromResolvedType(resolvedType: ResolvedType): TypeElement[] { @@ -3674,7 +3678,7 @@ namespace ts { } } - function lookupSymbolChain(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags) { + function lookupSymbolChain(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags, yieldModuleSymbol?: boolean) { context.tracker.trackSymbol(symbol, context.enclosingDeclaration, meaning); // Try to get qualified name if the symbol is not a type parameter and there is an enclosing declaration. let chain: Symbol[]; @@ -3714,7 +3718,7 @@ namespace ts { // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols. endOfChain || // If a parent symbol is an external module, don't write it. (We prefer just `x` vs `"foo/bar".x`.) - !(!parentSymbol && forEach(symbol.declarations, hasExternalModuleSymbol)) && + (yieldModuleSymbol || !(!parentSymbol && forEach(symbol.declarations, hasExternalModuleSymbol))) && // If a parent symbol is an anonymous type, don't write it. !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral))) { @@ -3762,8 +3766,8 @@ namespace ts { return top; } - function symbolToTypeNode(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags): TypeNode { - const chain = lookupSymbolChain(symbol, context, meaning); + function symbolToTypeNode(symbol: Symbol, context: NodeBuilderContext, meaning: SymbolFlags, overrideTypeArguments?: ReadonlyArray): TypeNode { + const chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope)); // If we're using aliases outside the current scope, dont bother with the module context.flags |= NodeBuilderFlags.InInitialEntityName; const rootName = getNameOfSymbolAsWritten(chain[0], context); @@ -3773,9 +3777,13 @@ namespace ts { if (ambientModuleSymbolRegex.test(rootName)) { // module is root, must use `ImportTypeNode` const nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined; - const typeParameterNodes = lookupTypeParameterNodes(chain, 0, context); + const typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context); const lit = createLiteralTypeNode(createLiteral(rootName.substring(1, rootName.length - 1))); if (!nonRootParts || isEntityName(nonRootParts)) { + if (nonRootParts) { + const lastId = isIdentifier(nonRootParts) ? nonRootParts : (nonRootParts as QualifiedName).right; + lastId.typeArguments = undefined; + } return createImportTypeNode(lit, nonRootParts as EntityName, typeParameterNodes as ReadonlyArray, isTypeOf); } else { @@ -3789,10 +3797,18 @@ namespace ts { if (isIndexedAccessTypeNode(entityName)) { return entityName; // Indexed accesses can never be `typeof` } - return isTypeOf ? createTypeQueryNode(entityName) : createTypeReferenceNode(entityName, /*typeArguments*/ undefined); + if (isTypeOf) { + return createTypeQueryNode(entityName); + } + else { + const lastId = isIdentifier(entityName) ? entityName : entityName.right; + const lastTypeArgs = lastId.typeArguments; + lastId.typeArguments = undefined; + return createTypeReferenceNode(entityName, lastTypeArgs as NodeArray); + } function createAccessFromSymbolChain(chain: Symbol[], index: number, stopper: number): EntityName | IndexedAccessTypeNode { - const typeParameterNodes = lookupTypeParameterNodes(chain, index, context); + const typeParameterNodes = index === (chain.length - 1) ? overrideTypeArguments : lookupTypeParameterNodes(chain, index, context); const symbol = chain[index]; if (index === 0) { @@ -3804,7 +3820,7 @@ namespace ts { } const parent = chain[index - 1]; - if (parent && getMembersOfSymbol(parent) && getMembersOfSymbol(parent).get(symbol.escapedName) === symbol) { + if (!(context.flags & NodeBuilderFlags.ForbidIndexedAccessSymbolReferences) && parent && getMembersOfSymbol(parent) && getMembersOfSymbol(parent).get(symbol.escapedName) === symbol) { // Should use an indexed access const LHS = createAccessFromSymbolChain(chain, index - 1, stopper); if (isIndexedAccessTypeNode(LHS)) { @@ -4007,6 +4023,23 @@ namespace ts { return "default"; } if (symbol.declarations && symbol.declarations.length) { + if (some(symbol.declarations, hasExternalModuleSymbol) && context.enclosingDeclaration) { + const file = getDeclarationOfKind(symbol, SyntaxKind.SourceFile); + if (!file || !context.tracker.moduleResolverHost) { + if (context.tracker.trackReferencedAmbientModule) { + const ambientDecls = filter(symbol.declarations, isAmbientModule); + if (length(ambientDecls)) { + for (const decl of ambientDecls) { + context.tracker.trackReferencedAmbientModule(decl); + } + } + } + // ambient module, just use declaration/symbol name (fallthrough) + } + else { + return `"${getResolvedExternalModuleName(context.tracker.moduleResolverHost, file, getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration)))}"`; + } + } const declaration = symbol.declarations[0]; const name = getNameOfDeclaration(declaration); if (name) { diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index b0191123591..346f1343fab 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -37,20 +37,23 @@ namespace ts { let lateStatementReplacementMap: Map>; let suppressNewDiagnosticContexts: boolean; + const host = context.getEmitHost(); const symbolTracker: SymbolTracker = { trackSymbol, reportInaccessibleThisError, reportInaccessibleUniqueSymbolError, - reportPrivateInBaseOfClassExpression + reportPrivateInBaseOfClassExpression, + moduleResolverHost: host, + trackReferencedAmbientModule, }; let errorNameNode: DeclarationName | undefined; let currentSourceFile: SourceFile; + let refs: Map; const resolver = context.getEmitResolver(); const options = context.getCompilerOptions(); const newLine = getNewLineCharacter(options); const { noResolve, stripInternal } = options; - const host = context.getEmitHost(); return transformRoot; function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives: string[]): void { @@ -63,6 +66,11 @@ namespace ts { } } + function trackReferencedAmbientModule(node: ModuleDeclaration) { + const container = getSourceFileOfNode(node); + refs.set("" + getOriginalNodeId(container), container); + } + function handleSymbolAccessibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) { if (symbolAccessibilityResult.accessibility === SymbolAccessibility.Accessible) { // Add aliases back onto the possible imports list if they're not there so we can try them again with updated visibility info @@ -197,13 +205,13 @@ namespace ts { lateMarkedStatements = undefined; lateStatementReplacementMap = createMap(); necessaryTypeRefernces = undefined; - const refs = collectReferences(currentSourceFile, createMap()); + refs = collectReferences(currentSourceFile, createMap()); const references: FileReference[] = []; const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(node, host, /*forceDtsPaths*/ true).declarationFilePath)); const referenceVisitor = mapReferencesIntoArray(references, outputFilePath); - refs.forEach(referenceVisitor); const statements = visitNodes(node.statements, visitDeclarationStatements); let combinedStatements = setTextRange(createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements); + refs.forEach(referenceVisitor); const emittedImports = filter(combinedStatements, isAnyImportSyntax); if (isExternalModule(node) && (!resultHasExternalModuleIndicator || (needsScopeFixMarker && !resultHasScopeMarker))) { combinedStatements = setTextRange(createNodeArray([...combinedStatements, createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([]), /*moduleSpecifier*/ undefined)]), combinedStatements); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7892b11eaea..6bb1fe24932 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3093,7 +3093,7 @@ namespace ts { WriteArrayAsGenericType = 1 << 1, // Write Array instead T[] GenerateNamesForShadowedTypeParams = 1 << 2, // When a type parameter T is shadowing another T, generate a name for it so it can still be referenced UseStructuralFallback = 1 << 3, // When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible - // empty space + ForbidIndexedAccessSymbolReferences = 1 << 4, // Forbid references like `I["a"]["b"]` - print `typeof I.a.b` instead WriteTypeArgumentsOfSignature = 1 << 5, // Write the type arguments instead of type parameters of the signature UseFullyQualifiedType = 1 << 6, // Write out the fully qualified type name (eg. Module.Type, instead of Type) UseOnlyExternalAliasing = 1 << 7, // Only use external aliases for a symbol @@ -5258,6 +5258,13 @@ namespace ts { isAtStartOfLine(): boolean; } + /* @internal */ + export interface ModuleNameResolverHost { + getCanonicalFileName(f: string): string; + getCommonSourceDirectory(): string; + getCurrentDirectory(): string; + } + /** @deprecated See comment on SymbolWriter */ // Note: this has non-deprecated internal uses. export interface SymbolTracker { @@ -5268,6 +5275,10 @@ namespace ts { reportInaccessibleThisError?(): void; reportPrivateInBaseOfClassExpression?(propertyName: string): void; reportInaccessibleUniqueSymbolError?(): void; + /* @internal */ + moduleResolverHost?: ModuleNameResolverHost; + /* @internal */ + trackReferencedAmbientModule?(decl: ModuleDeclaration): void; } export interface TextSpan { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6e440e01ecf..8fab560850d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2878,11 +2878,11 @@ namespace ts { }; } - export function getResolvedExternalModuleName(host: EmitHost, file: SourceFile): string { - return file.moduleName || getExternalModuleNameFromPath(host, file.fileName); + export function getResolvedExternalModuleName(host: ModuleNameResolverHost, file: SourceFile, referenceFile?: SourceFile): string { + return file.moduleName || getExternalModuleNameFromPath(host, file.fileName, referenceFile && referenceFile.fileName); } - export function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode): string { + export function getExternalModuleNameFromDeclaration(host: ModuleNameResolverHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration | ImportTypeNode): string { const file = resolver.getExternalModuleFileFromDeclaration(declaration); if (!file || file.isDeclarationFile) { return undefined; @@ -2893,12 +2893,13 @@ namespace ts { /** * Resolves a local path to a path which is absolute to the base of the emit */ - export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string { + export function getExternalModuleNameFromPath(host: ModuleNameResolverHost, fileName: string, referencePath?: string): string { const getCanonicalFileName = (f: string) => host.getCanonicalFileName(f); - const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); + const dir = toPath(referencePath ? getDirectoryPath(referencePath) : host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName); const filePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); const relativePath = getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); - return removeFileExtension(relativePath); + const extensionless = removeFileExtension(relativePath); + return referencePath ? ensurePathIsNonModuleName(extensionless) : extensionless; } export function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string) { diff --git a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types index 2953ede4026..d6f799c3667 100644 --- a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types +++ b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types @@ -1,6 +1,6 @@ === tests/cases/compiler/Class.ts === import { Configurable } from "./Configurable" ->Configurable : {}>(base: T) => T +>Configurable : >(base: T) => T export class HiddenClass {} >HiddenClass : HiddenClass @@ -8,7 +8,7 @@ export class HiddenClass {} export class ActualClass extends Configurable(HiddenClass) {} >ActualClass : ActualClass >Configurable(HiddenClass) : HiddenClass ->Configurable : {}>(base: T) => T +>Configurable : >(base: T) => T >HiddenClass : typeof HiddenClass === tests/cases/compiler/Configurable.ts === diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 1cf0b12522b..ae163fb4f8d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1900,6 +1900,7 @@ declare namespace ts { WriteArrayAsGenericType = 2, GenerateNamesForShadowedTypeParams = 4, UseStructuralFallback = 8, + ForbidIndexedAccessSymbolReferences = 16, WriteTypeArgumentsOfSignature = 32, UseFullyQualifiedType = 64, UseOnlyExternalAliasing = 128, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 35669b096e3..89552e727c2 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1900,6 +1900,7 @@ declare namespace ts { WriteArrayAsGenericType = 2, GenerateNamesForShadowedTypeParams = 4, UseStructuralFallback = 8, + ForbidIndexedAccessSymbolReferences = 16, WriteTypeArgumentsOfSignature = 32, UseFullyQualifiedType = 64, UseOnlyExternalAliasing = 128, diff --git a/tests/baselines/reference/augmentExportEquals5.types b/tests/baselines/reference/augmentExportEquals5.types index c071a195f0e..f9cc2bfeae9 100644 --- a/tests/baselines/reference/augmentExportEquals5.types +++ b/tests/baselines/reference/augmentExportEquals5.types @@ -18,7 +18,7 @@ declare module "express" { function e(): e.Express; >e : typeof e >e : any ->Express : Express +>Express : e.Express namespace e { >e : typeof e diff --git a/tests/baselines/reference/declarationEmitAliasFromIndirectFile.js b/tests/baselines/reference/declarationEmitAliasFromIndirectFile.js index 1d55514eb9d..105b406cdad 100644 --- a/tests/baselines/reference/declarationEmitAliasFromIndirectFile.js +++ b/tests/baselines/reference/declarationEmitAliasFromIndirectFile.js @@ -36,24 +36,9 @@ exports["default"] = fp.l10ns; //// [app.d.ts] declare const _default: { - ar?: { - weekdays: { - shorthand: [string, string, string, string, string, string, string]; - longhand: [string, string, string, string, string, string, string]; - }; - }; - bg?: { - weekdays: { - shorthand: [string, string, string, string, string, string, string]; - longhand: [string, string, string, string, string, string, string]; - }; - }; + ar?: import("./locale").CustomLocale; + bg?: import("./locale").CustomLocale; } & { - default: { - weekdays: { - shorthand: [string, string, string, string, string, string, string]; - longhand: [string, string, string, string, string, string, string]; - }; - }; + default: import("./locale").Locale; }; export default _default; diff --git a/tests/baselines/reference/declarationEmitAliasFromIndirectFile.types b/tests/baselines/reference/declarationEmitAliasFromIndirectFile.types index 16730debf8e..35557a1fd1d 100644 --- a/tests/baselines/reference/declarationEmitAliasFromIndirectFile.types +++ b/tests/baselines/reference/declarationEmitAliasFromIndirectFile.types @@ -62,7 +62,7 @@ const fp = { l10ns: {} } as FlatpickrFn; >FlatpickrFn : FlatpickrFn export default fp.l10ns; ->fp.l10ns : { ar?: { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }; }; bg?: { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }; }; } & { default: { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }; }; } +>fp.l10ns : { ar?: import("tests/cases/compiler/locale").CustomLocale; bg?: import("tests/cases/compiler/locale").CustomLocale; } & { default: import("tests/cases/compiler/locale").Locale; } >fp : FlatpickrFn ->l10ns : { ar?: { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }; }; bg?: { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }; }; } & { default: { weekdays: { shorthand: [string, string, string, string, string, string, string]; longhand: [string, string, string, string, string, string, string]; }; }; } +>l10ns : { ar?: import("tests/cases/compiler/locale").CustomLocale; bg?: import("tests/cases/compiler/locale").CustomLocale; } & { default: import("tests/cases/compiler/locale").Locale; } diff --git a/tests/baselines/reference/declarationEmitInferredTypeAlias7.js b/tests/baselines/reference/declarationEmitInferredTypeAlias7.js index ff44c18f918..d2977b6b78c 100644 --- a/tests/baselines/reference/declarationEmitInferredTypeAlias7.js +++ b/tests/baselines/reference/declarationEmitInferredTypeAlias7.js @@ -22,5 +22,5 @@ exports.v = v; //// [0.d.ts] export declare type Data = string | boolean; //// [1.d.ts] -declare let v: string | boolean; +declare let v: import("./0").Data; export { v }; diff --git a/tests/baselines/reference/declarationEmitInferredTypeAlias7.types b/tests/baselines/reference/declarationEmitInferredTypeAlias7.types index 72289ce63dd..a1af3ba3790 100644 --- a/tests/baselines/reference/declarationEmitInferredTypeAlias7.types +++ b/tests/baselines/reference/declarationEmitInferredTypeAlias7.types @@ -9,11 +9,11 @@ let obj: Data = true; === tests/cases/compiler/1.ts === let v = "str" || true; ->v : string | boolean +>v : import("tests/cases/compiler/0").Data >"str" || true : true | "str" >"str" : "str" >true : true export { v } ->v : string | boolean +>v : import("tests/cases/compiler/0").Data diff --git a/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.js b/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.js new file mode 100644 index 00000000000..51d9b02b2b2 --- /dev/null +++ b/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.js @@ -0,0 +1,48 @@ +//// [tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts] //// + +//// [file1.ts] +export class Foo {} +//// [file2.ts] +export function foo(): import("./file1").Foo { + return null as any; +} +//// [file3.ts] +import {foo} from "./file2"; +export function bar() { + return foo(); +} + + +//// [file1.js] +"use strict"; +exports.__esModule = true; +var Foo = /** @class */ (function () { + function Foo() { + } + return Foo; +}()); +exports.Foo = Foo; +//// [file2.js] +"use strict"; +exports.__esModule = true; +function foo() { + return null; +} +exports.foo = foo; +//// [file3.js] +"use strict"; +exports.__esModule = true; +var file2_1 = require("./file2"); +function bar() { + return file2_1.foo(); +} +exports.bar = bar; + + +//// [file1.d.ts] +export declare class Foo { +} +//// [file2.d.ts] +export declare function foo(): import("./file1").Foo; +//// [file3.d.ts] +export declare function bar(): import("./file1").Foo; diff --git a/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.symbols b/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.symbols new file mode 100644 index 00000000000..7fdd97737f4 --- /dev/null +++ b/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/file1.ts === +export class Foo {} +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) + +=== tests/cases/compiler/file2.ts === +export function foo(): import("./file1").Foo { +>foo : Symbol(foo, Decl(file2.ts, 0, 0)) +>Foo : Symbol(Foo, Decl(file1.ts, 0, 0)) + + return null as any; +} +=== tests/cases/compiler/file3.ts === +import {foo} from "./file2"; +>foo : Symbol(foo, Decl(file3.ts, 0, 8)) + +export function bar() { +>bar : Symbol(bar, Decl(file3.ts, 0, 28)) + + return foo(); +>foo : Symbol(foo, Decl(file3.ts, 0, 8)) +} + diff --git a/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.types b/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.types new file mode 100644 index 00000000000..587fefaacc1 --- /dev/null +++ b/tests/baselines/reference/declarationsForInferredTypeFromOtherFile.types @@ -0,0 +1,25 @@ +=== tests/cases/compiler/file1.ts === +export class Foo {} +>Foo : Foo + +=== tests/cases/compiler/file2.ts === +export function foo(): import("./file1").Foo { +>foo : () => import("tests/cases/compiler/file1").Foo +>Foo : import("tests/cases/compiler/file1").Foo + + return null as any; +>null as any : any +>null : null +} +=== tests/cases/compiler/file3.ts === +import {foo} from "./file2"; +>foo : () => import("tests/cases/compiler/file1").Foo + +export function bar() { +>bar : () => import("tests/cases/compiler/file1").Foo + + return foo(); +>foo() : import("tests/cases/compiler/file1").Foo +>foo : () => import("tests/cases/compiler/file1").Foo +} + diff --git a/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types index 5fd92f6e2eb..7fbf4e36586 100644 --- a/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types +++ b/tests/baselines/reference/doubleMixinConditionalTypeBaseClassWorks.types @@ -4,39 +4,39 @@ type Constructor = new (...args: any[]) => {}; >args : any[] const Mixin1 = (Base: C) => class extends Base { private _fooPrivate: {}; } ->Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C ->(Base: C) => class extends Base { private _fooPrivate: {}; } : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: Mixin1.(Anonymous class); } & C +>(Base: C) => class extends Base { private _fooPrivate: {}; } : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: Mixin1.(Anonymous class); } & C >C : C >Constructor : Constructor >Base : C >C : C ->class extends Base { private _fooPrivate: {}; } : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>class extends Base { private _fooPrivate: {}; } : { new (...args: any[]): (Anonymous class); prototype: Mixin1.(Anonymous class); } & C >Base : {} >_fooPrivate : {} type FooConstructor = typeof Mixin1 extends (a: Constructor) => infer Cls ? Cls : never; ->FooConstructor : { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & Constructor ->Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>FooConstructor : { new (...args: any[]): Mixin1.(Anonymous class); prototype: Mixin1.(Anonymous class); } & Constructor +>Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: Mixin1.(Anonymous class); } & C >a : Constructor >Constructor : Constructor >Cls : Cls >Cls : Cls const Mixin2 = (Base: C) => class extends Base {}; ->Mixin2 : .(Anonymous class); prototype: .(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C ->(Base: C) => class extends Base {} : .(Anonymous class); prototype: .(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>Mixin2 : .(Anonymous class); prototype: Mixin1.(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: Mixin2.(Anonymous class); } & C +>(Base: C) => class extends Base {} : .(Anonymous class); prototype: Mixin1.(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: Mixin2.(Anonymous class); } & C >C : C ->FooConstructor : { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & Constructor +>FooConstructor : { new (...args: any[]): Mixin1.(Anonymous class); prototype: Mixin1.(Anonymous class); } & Constructor >Base : C >C : C ->class extends Base {} : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C ->Base : .(Anonymous class) +>class extends Base {} : { new (...args: any[]): (Anonymous class); prototype: Mixin2.(Anonymous class); } & C +>Base : Mixin1.(Anonymous class) class C extends Mixin2(Mixin1(Object)) {} >C : C ->Mixin2(Mixin1(Object)) : <{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & ObjectConstructor>.(Anonymous class) & .(Anonymous class) & Object ->Mixin2 : .(Anonymous class); prototype: .(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C ->Mixin1(Object) : { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); } & ObjectConstructor ->Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & C +>Mixin2(Mixin1(Object)) : Mixin2<{ new (...args: any[]): Mixin1.(Anonymous class); prototype: Mixin1.(Anonymous class); } & ObjectConstructor>.(Anonymous class) & Mixin1.(Anonymous class) & Object +>Mixin2 : .(Anonymous class); prototype: Mixin1.(Anonymous class); } & Constructor>(Base: C) => { new (...args: any[]): (Anonymous class); prototype: Mixin2.(Anonymous class); } & C +>Mixin1(Object) : { new (...args: any[]): Mixin1.(Anonymous class); prototype: Mixin1.(Anonymous class); } & ObjectConstructor +>Mixin1 : (Base: C) => { new (...args: any[]): (Anonymous class); prototype: Mixin1.(Anonymous class); } & C >Object : ObjectConstructor diff --git a/tests/baselines/reference/duplicatePackage.errors.txt b/tests/baselines/reference/duplicatePackage.errors.txt index 917ed711c64..99d5a3f29cc 100644 --- a/tests/baselines/reference/duplicatePackage.errors.txt +++ b/tests/baselines/reference/duplicatePackage.errors.txt @@ -1,4 +1,4 @@ -/src/a.ts(5,3): error TS2345: Argument of type 'X' is not assignable to parameter of type 'X'. +/src/a.ts(5,3): error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'. Types have separate declarations of a private property 'x'. @@ -9,7 +9,7 @@ a(b); // Works a(c); // Error, these are from different versions of the library. ~ -!!! error TS2345: Argument of type 'X' is not assignable to parameter of type 'X'. +!!! error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'. !!! error TS2345: Types have separate declarations of a private property 'x'. ==== /node_modules/a/index.d.ts (0 errors) ==== diff --git a/tests/baselines/reference/duplicatePackage.types b/tests/baselines/reference/duplicatePackage.types index 689d7a5c5bc..261b87595b7 100644 --- a/tests/baselines/reference/duplicatePackage.types +++ b/tests/baselines/reference/duplicatePackage.types @@ -1,22 +1,22 @@ === /src/a.ts === import { a } from "a"; ->a : (x: default) => void +>a : (x: import("/node_modules/a/node_modules/x/index").default) => void import { b } from "b"; ->b : default +>b : import("/node_modules/a/node_modules/x/index").default import { c } from "c"; ->c : default +>c : import("/node_modules/c/node_modules/x/index").default a(b); // Works >a(b) : void ->a : (x: default) => void ->b : default +>a : (x: import("/node_modules/a/node_modules/x/index").default) => void +>b : import("/node_modules/a/node_modules/x/index").default a(c); // Error, these are from different versions of the library. >a(c) : void ->a : (x: default) => void ->c : default +>a : (x: import("/node_modules/a/node_modules/x/index").default) => void +>c : import("/node_modules/c/node_modules/x/index").default === /node_modules/a/index.d.ts === import X from "x"; diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types index 33931774a1b..e7079388c42 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types @@ -1,14 +1,14 @@ === /index.ts === import { use } from "foo/use"; ->use : (o: C) => void +>use : (o: import("/node_modules/foo/index").C) => void import { o } from "a"; ->o : C +>o : import("/node_modules/foo/index").C use(o); >use(o) : void ->use : (o: C) => void ->o : C +>use : (o: import("/node_modules/foo/index").C) => void +>o : import("/node_modules/foo/index").C === /node_modules/a/node_modules/foo/index.d.ts === export class C { diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types index 7be2442bf3b..e38678b7acf 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types @@ -1,14 +1,14 @@ === /index.ts === import { use } from "@foo/bar/use"; ->use : (o: C) => void +>use : (o: import("/node_modules/@foo/bar/index").C) => void import { o } from "a"; ->o : C +>o : import("/node_modules/@foo/bar/index").C use(o); >use(o) : void ->use : (o: C) => void ->o : C +>use : (o: import("/node_modules/@foo/bar/index").C) => void +>o : import("/node_modules/@foo/bar/index").C === /node_modules/a/node_modules/@foo/bar/index.d.ts === export class C { diff --git a/tests/baselines/reference/es5ExportEquals.types b/tests/baselines/reference/es5ExportEquals.types index 6c9e8930537..6f138b0e862 100644 --- a/tests/baselines/reference/es5ExportEquals.types +++ b/tests/baselines/reference/es5ExportEquals.types @@ -1,6 +1,6 @@ === tests/cases/compiler/es5ExportEquals.ts === export function f() { } ->f : typeof f +>f : typeof import("tests/cases/compiler/es5ExportEquals").f export = f; >f : () => void diff --git a/tests/baselines/reference/es6ExportEquals.types b/tests/baselines/reference/es6ExportEquals.types index 3ba761dc8e5..be19f33bac4 100644 --- a/tests/baselines/reference/es6ExportEquals.types +++ b/tests/baselines/reference/es6ExportEquals.types @@ -1,6 +1,6 @@ === tests/cases/compiler/es6ExportEquals.ts === export function f() { } ->f : typeof f +>f : typeof import("tests/cases/compiler/es6ExportEquals").f export = f; >f : () => void diff --git a/tests/baselines/reference/exportClassExtendingIntersection.js b/tests/baselines/reference/exportClassExtendingIntersection.js index 70ea0b3b53a..f94696a348c 100644 --- a/tests/baselines/reference/exportClassExtendingIntersection.js +++ b/tests/baselines/reference/exportClassExtendingIntersection.js @@ -114,7 +114,7 @@ export declare function MyMixin>>(base: T //// [FinalClass.d.ts] import { MyBaseClass } from './BaseClass'; import { MyMixin } from './MixinClass'; -declare const MyExtendedClass_base: typeof MyBaseClass & (new (...args: any[]) => MyMixin); +declare const MyExtendedClass_base: typeof MyBaseClass & import("./BaseClass").Constructor; export declare class MyExtendedClass extends MyExtendedClass_base { extendedClassProperty: number; } diff --git a/tests/baselines/reference/exportClassExtendingIntersection.types b/tests/baselines/reference/exportClassExtendingIntersection.types index 5840c53a056..6dc2a7fdcf4 100644 --- a/tests/baselines/reference/exportClassExtendingIntersection.types +++ b/tests/baselines/reference/exportClassExtendingIntersection.types @@ -52,12 +52,12 @@ import { MyBaseClass } from './BaseClass'; >MyBaseClass : typeof MyBaseClass import { MyMixin } from './MixinClass'; ->MyMixin : MyBaseClass>(base: T) => T & (new (...args: any[]) => MyMixin) +>MyMixin : >>(base: T) => T & import("tests/cases/compiler/BaseClass").Constructor export class MyExtendedClass extends MyMixin(MyBaseClass) { >MyExtendedClass : MyExtendedClass >MyMixin(MyBaseClass) : MyBaseClass & MyMixin ->MyMixin : MyBaseClass>(base: T) => T & (new (...args: any[]) => MyMixin) +>MyMixin : >>(base: T) => T & import("tests/cases/compiler/BaseClass").Constructor >MyBaseClass : typeof MyBaseClass extendedClassProperty: number; @@ -68,7 +68,7 @@ import { MyExtendedClass } from './FinalClass'; >MyExtendedClass : typeof MyExtendedClass import { MyMixin } from './MixinClass'; ->MyMixin : MyBaseClass>(base: T) => T & (new (...args: any[]) => MyMixin) +>MyMixin : >>(base: T) => T & import("tests/cases/compiler/BaseClass").Constructor const myExtendedClass = new MyExtendedClass('string'); >myExtendedClass : MyExtendedClass @@ -77,8 +77,8 @@ const myExtendedClass = new MyExtendedClass('string'); >'string' : "string" const AnotherMixedClass = MyMixin(MyExtendedClass); ->AnotherMixedClass : typeof MyExtendedClass & (new (...args: any[]) => MyMixin) ->MyMixin(MyExtendedClass) : typeof MyExtendedClass & (new (...args: any[]) => MyMixin) ->MyMixin : MyBaseClass>(base: T) => T & (new (...args: any[]) => MyMixin) +>AnotherMixedClass : typeof MyExtendedClass & import("tests/cases/compiler/BaseClass").Constructor +>MyMixin(MyExtendedClass) : typeof MyExtendedClass & import("tests/cases/compiler/BaseClass").Constructor +>MyMixin : >>(base: T) => T & import("tests/cases/compiler/BaseClass").Constructor >MyExtendedClass : typeof MyExtendedClass diff --git a/tests/baselines/reference/giant.types b/tests/baselines/reference/giant.types index b571ea79b81..b67b9c1efd1 100644 --- a/tests/baselines/reference/giant.types +++ b/tests/baselines/reference/giant.types @@ -870,7 +870,7 @@ export interface eI { >pa2 : any } export module eM { ->eM : typeof eM +>eM : typeof import("tests/cases/compiler/giant").eM var V; >V : any diff --git a/tests/baselines/reference/importCallExpression3ESNext.types b/tests/baselines/reference/importCallExpression3ESNext.types index 4d81b4ec331..416574f213e 100644 --- a/tests/baselines/reference/importCallExpression3ESNext.types +++ b/tests/baselines/reference/importCallExpression3ESNext.types @@ -13,12 +13,12 @@ async function foo() { class C extends (await import("./0")).B {} >C : C ->(await import("./0")).B : B +>(await import("./0")).B : import("tests/cases/conformance/dynamicImport/0").B >(await import("./0")) : typeof import("tests/cases/conformance/dynamicImport/0") >await import("./0") : typeof import("tests/cases/conformance/dynamicImport/0") >import("./0") : Promise >"./0" : "./0" ->B : typeof B +>B : typeof import("tests/cases/conformance/dynamicImport/0").B var c = new C(); >c : C diff --git a/tests/baselines/reference/importCallExpressionDeclarationEmit2.errors.txt b/tests/baselines/reference/importCallExpressionDeclarationEmit2.errors.txt deleted file mode 100644 index 6c394c98bdf..00000000000 --- a/tests/baselines/reference/importCallExpressionDeclarationEmit2.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/dynamicImport/1.ts(1,5): error TS4023: Exported variable 'p1' has or is using name '"tests/cases/conformance/dynamicImport/0"' from external module "tests/cases/conformance/dynamicImport/0" but cannot be named. - - -==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ==== - export function foo() { return "foo"; } - -==== tests/cases/conformance/dynamicImport/1.ts (1 errors) ==== - var p1 = import("./0"); - ~~ -!!! error TS4023: Exported variable 'p1' has or is using name '"tests/cases/conformance/dynamicImport/0"' from external module "tests/cases/conformance/dynamicImport/0" but cannot be named. \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionDeclarationEmit2.js b/tests/baselines/reference/importCallExpressionDeclarationEmit2.js index 7659e94ee81..a83aa5b84c9 100644 --- a/tests/baselines/reference/importCallExpressionDeclarationEmit2.js +++ b/tests/baselines/reference/importCallExpressionDeclarationEmit2.js @@ -14,3 +14,5 @@ var p1 = import("./0"); //// [0.d.ts] export declare function foo(): string; +//// [1.d.ts] +declare var p1: Promise; diff --git a/tests/baselines/reference/importCallExpressionInAMD3.types b/tests/baselines/reference/importCallExpressionInAMD3.types index 4d81b4ec331..416574f213e 100644 --- a/tests/baselines/reference/importCallExpressionInAMD3.types +++ b/tests/baselines/reference/importCallExpressionInAMD3.types @@ -13,12 +13,12 @@ async function foo() { class C extends (await import("./0")).B {} >C : C ->(await import("./0")).B : B +>(await import("./0")).B : import("tests/cases/conformance/dynamicImport/0").B >(await import("./0")) : typeof import("tests/cases/conformance/dynamicImport/0") >await import("./0") : typeof import("tests/cases/conformance/dynamicImport/0") >import("./0") : Promise >"./0" : "./0" ->B : typeof B +>B : typeof import("tests/cases/conformance/dynamicImport/0").B var c = new C(); >c : C diff --git a/tests/baselines/reference/importCallExpressionInCJS4.types b/tests/baselines/reference/importCallExpressionInCJS4.types index 4d81b4ec331..416574f213e 100644 --- a/tests/baselines/reference/importCallExpressionInCJS4.types +++ b/tests/baselines/reference/importCallExpressionInCJS4.types @@ -13,12 +13,12 @@ async function foo() { class C extends (await import("./0")).B {} >C : C ->(await import("./0")).B : B +>(await import("./0")).B : import("tests/cases/conformance/dynamicImport/0").B >(await import("./0")) : typeof import("tests/cases/conformance/dynamicImport/0") >await import("./0") : typeof import("tests/cases/conformance/dynamicImport/0") >import("./0") : Promise >"./0" : "./0" ->B : typeof B +>B : typeof import("tests/cases/conformance/dynamicImport/0").B var c = new C(); >c : C diff --git a/tests/baselines/reference/importCallExpressionInSystem3.types b/tests/baselines/reference/importCallExpressionInSystem3.types index 4d81b4ec331..416574f213e 100644 --- a/tests/baselines/reference/importCallExpressionInSystem3.types +++ b/tests/baselines/reference/importCallExpressionInSystem3.types @@ -13,12 +13,12 @@ async function foo() { class C extends (await import("./0")).B {} >C : C ->(await import("./0")).B : B +>(await import("./0")).B : import("tests/cases/conformance/dynamicImport/0").B >(await import("./0")) : typeof import("tests/cases/conformance/dynamicImport/0") >await import("./0") : typeof import("tests/cases/conformance/dynamicImport/0") >import("./0") : Promise >"./0" : "./0" ->B : typeof B +>B : typeof import("tests/cases/conformance/dynamicImport/0").B var c = new C(); >c : C diff --git a/tests/baselines/reference/importCallExpressionInUMD3.types b/tests/baselines/reference/importCallExpressionInUMD3.types index 4d81b4ec331..416574f213e 100644 --- a/tests/baselines/reference/importCallExpressionInUMD3.types +++ b/tests/baselines/reference/importCallExpressionInUMD3.types @@ -13,12 +13,12 @@ async function foo() { class C extends (await import("./0")).B {} >C : C ->(await import("./0")).B : B +>(await import("./0")).B : import("tests/cases/conformance/dynamicImport/0").B >(await import("./0")) : typeof import("tests/cases/conformance/dynamicImport/0") >await import("./0") : typeof import("tests/cases/conformance/dynamicImport/0") >import("./0") : Promise >"./0" : "./0" ->B : typeof B +>B : typeof import("tests/cases/conformance/dynamicImport/0").B var c = new C(); >c : C diff --git a/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.js b/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.js index a1316dbdd46..bb453e398b2 100644 --- a/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.js +++ b/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.js @@ -21,6 +21,4 @@ exports.thing = umd_1.makeThing(); //// [index.d.ts] -export declare const thing: { - a: number; -}; +export declare const thing: import("./node_modules/umd").Thing; diff --git a/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.types b/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.types index c12cd511cb9..c0db43ab660 100644 --- a/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.types +++ b/tests/baselines/reference/importShouldNotBeElidedInDeclarationEmit.types @@ -15,10 +15,10 @@ export declare function makeThing(): Thing; === tests/cases/compiler/index.ts === import { makeThing } from "umd"; ->makeThing : () => { a: number; } +>makeThing : () => import("tests/cases/compiler/node_modules/umd").Thing export const thing = makeThing(); ->thing : { a: number; } ->makeThing() : { a: number; } ->makeThing : () => { a: number; } +>thing : import("tests/cases/compiler/node_modules/umd").Thing +>makeThing() : import("tests/cases/compiler/node_modules/umd").Thing +>makeThing : () => import("tests/cases/compiler/node_modules/umd").Thing diff --git a/tests/baselines/reference/localTypes5.types b/tests/baselines/reference/localTypes5.types index 54e28d35a32..abafad755f4 100644 --- a/tests/baselines/reference/localTypes5.types +++ b/tests/baselines/reference/localTypes5.types @@ -1,18 +1,18 @@ === tests/cases/conformance/types/localTypes/localTypes5.ts === function foo() { ->foo : () => X.m..Y +>foo : () => X.m.(Anonymous function).Y >A : A class X { >X : X m() { ->m : () => .Y +>m : () => (Anonymous function).Y >B : B >C : C return (function () { ->(function () { class Y { } return new Y(); })() : .Y +>(function () { class Y { } return new Y(); })() : (Anonymous function).Y >(function () { class Y { } return new Y(); }) : () => Y >function () { class Y { } return new Y(); } : () => Y >D : D @@ -35,13 +35,13 @@ function foo() { >X : typeof X return x.m(); ->x.m() : X.m..Y ->x.m : () => X.m..Y +>x.m() : X.m.(Anonymous function).Y +>x.m : () => X.m.(Anonymous function).Y >x : X ->m : () => X.m..Y +>m : () => X.m.(Anonymous function).Y } var x = foo(); ->x : foo.X.m..Y ->foo() : foo.X.m..Y ->foo : () => X.m..Y +>x : foo.X.m.(Anonymous function).Y +>foo() : foo.X.m.(Anonymous function).Y +>foo : () => X.m.(Anonymous function).Y diff --git a/tests/baselines/reference/mergedDeclarationExports.types b/tests/baselines/reference/mergedDeclarationExports.types index 2f30831c84b..1292483830b 100644 --- a/tests/baselines/reference/mergedDeclarationExports.types +++ b/tests/baselines/reference/mergedDeclarationExports.types @@ -33,7 +33,7 @@ interface d {} >d : d export class d {} ->d : d +>d : import("tests/cases/compiler/mergedDeclarationExports").d // both namespaces namespace N { } diff --git a/tests/baselines/reference/mixinClassesAnnotated.types b/tests/baselines/reference/mixinClassesAnnotated.types index 9d30171e3d8..aba1934a211 100644 --- a/tests/baselines/reference/mixinClassesAnnotated.types +++ b/tests/baselines/reference/mixinClassesAnnotated.types @@ -51,7 +51,7 @@ const Printable = >(superClass: T): ConstructorT : T class extends superClass { ->class extends superClass { static message = "hello"; print() { const output = this.x + "," + this.y; } } : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); message: string; } & T +>class extends superClass { static message = "hello"; print() { const output = this.x + "," + this.y; } } : { new (...args: any[]): (Anonymous class); prototype: Printable.(Anonymous class); message: string; } & T >superClass : Base static message = "hello"; diff --git a/tests/baselines/reference/mixinClassesAnonymous.types b/tests/baselines/reference/mixinClassesAnonymous.types index 516b15af2f3..2d9ef464172 100644 --- a/tests/baselines/reference/mixinClassesAnonymous.types +++ b/tests/baselines/reference/mixinClassesAnonymous.types @@ -31,14 +31,14 @@ class Derived extends Base { } const Printable = >(superClass: T) => class extends superClass { ->Printable : >(superClass: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); message: string; } & T ->>(superClass: T) => class extends superClass { static message = "hello"; print() { const output = this.x + "," + this.y; }} : >(superClass: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); message: string; } & T +>Printable : >(superClass: T) => { new (...args: any[]): (Anonymous class); prototype: Printable.(Anonymous class); message: string; } & T +>>(superClass: T) => class extends superClass { static message = "hello"; print() { const output = this.x + "," + this.y; }} : >(superClass: T) => { new (...args: any[]): (Anonymous class); prototype: Printable.(Anonymous class); message: string; } & T >T : T >Constructor : Constructor >Base : Base >superClass : T >T : T ->class extends superClass { static message = "hello"; print() { const output = this.x + "," + this.y; }} : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); message: string; } & T +>class extends superClass { static message = "hello"; print() { const output = this.x + "," + this.y; }} : { new (...args: any[]): (Anonymous class); prototype: Printable.(Anonymous class); message: string; } & T >superClass : Base static message = "hello"; @@ -104,16 +104,16 @@ const Thing1 = Tagged(Derived); >Derived : typeof Derived const Thing2 = Tagged(Printable(Derived)); ->Thing2 : { new (...args: any[]): Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived ->Tagged(Printable(Derived)) : { new (...args: any[]): Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived +>Thing2 : { new (...args: any[]): Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived +>Tagged(Printable(Derived)) : { new (...args: any[]): Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived >Tagged : >(superClass: T) => { new (...args: any[]): C; prototype: Tagged.C; } & T ->Printable(Derived) : { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived ->Printable : >(superClass: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); message: string; } & T +>Printable(Derived) : { new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived +>Printable : >(superClass: T) => { new (...args: any[]): (Anonymous class); prototype: Printable.(Anonymous class); message: string; } & T >Derived : typeof Derived Thing2.message; >Thing2.message : string ->Thing2 : { new (...args: any[]): Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived +>Thing2 : { new (...args: any[]): Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived >message : string function f1() { @@ -142,40 +142,40 @@ function f2() { >f2 : () => void const thing = new Thing2(1, 2, 3); ->thing : Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C & .(Anonymous class) & Derived ->new Thing2(1, 2, 3) : Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C & .(Anonymous class) & Derived ->Thing2 : { new (...args: any[]): Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived +>thing : Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C & Printable.(Anonymous class) & Derived +>new Thing2(1, 2, 3) : Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C & Printable.(Anonymous class) & Derived +>Thing2 : { new (...args: any[]): Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived >1 : 1 >2 : 2 >3 : 3 thing.x; >thing.x : number ->thing : Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C & .(Anonymous class) & Derived +>thing : Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C & Printable.(Anonymous class) & Derived >x : number thing._tag; >thing._tag : string ->thing : Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C & .(Anonymous class) & Derived +>thing : Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C & Printable.(Anonymous class) & Derived >_tag : string thing.print(); >thing.print() : void >thing.print : () => void ->thing : Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C & .(Anonymous class) & Derived +>thing : Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C & Printable.(Anonymous class) & Derived >print : () => void } class Thing3 extends Thing2 { >Thing3 : Thing3 ->Thing2 : Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C & .(Anonymous class) & Derived +>Thing2 : Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C & Printable.(Anonymous class) & Derived constructor(tag: string) { >tag : string super(10, 20, 30); >super(10, 20, 30) : void ->super : { new (...args: any[]): Tagged<{ new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): .(Anonymous class); prototype: .(Anonymous class); message: string; } & typeof Derived +>super : { new (...args: any[]): Tagged<{ new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived>.C; prototype: Tagged.C; } & { new (...args: any[]): Printable.(Anonymous class); prototype: Printable.(Anonymous class); message: string; } & typeof Derived >10 : 10 >20 : 20 >30 : 30 @@ -201,15 +201,15 @@ class Thing3 extends Thing2 { // Repro from #13805 const Timestamped = >(Base: CT) => { ->Timestamped : >(Base: CT) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & CT ->>(Base: CT) => { return class extends Base { timestamp = new Date(); };} : >(Base: CT) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & CT +>Timestamped : >(Base: CT) => { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } & CT +>>(Base: CT) => { return class extends Base { timestamp = new Date(); };} : >(Base: CT) => { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } & CT >CT : CT >Constructor : Constructor >Base : CT >CT : CT return class extends Base { ->class extends Base { timestamp = new Date(); } : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & CT +>class extends Base { timestamp = new Date(); } : { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } & CT >Base : object timestamp = new Date(); diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports1.types b/tests/baselines/reference/moduleAugmentationImportsAndExports1.types index 8315676d230..974a2046b20 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports1.types +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports1.types @@ -52,9 +52,9 @@ let a: A; let b = a.foo().n; >b : number >a.foo().n : number ->a.foo() : B ->a.foo : () => B +>a.foo() : import("tests/cases/compiler/f2").B +>a.foo : () => import("tests/cases/compiler/f2").B >a : A ->foo : () => B +>foo : () => import("tests/cases/compiler/f2").B >n : number diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports4.types b/tests/baselines/reference/moduleAugmentationImportsAndExports4.types index 771731ecdb3..d519ed0933a 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports4.types +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports4.types @@ -81,10 +81,10 @@ let a: A; let b = a.foo().n; >b : number >a.foo().n : number ->a.foo() : B ->a.foo : () => B +>a.foo() : import("tests/cases/compiler/f2").B +>a.foo : () => import("tests/cases/compiler/f2").B >a : A ->foo : () => B +>foo : () => import("tests/cases/compiler/f2").B >n : number let c = a.bar().a; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports5.types b/tests/baselines/reference/moduleAugmentationImportsAndExports5.types index 771731ecdb3..d519ed0933a 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports5.types +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports5.types @@ -81,10 +81,10 @@ let a: A; let b = a.foo().n; >b : number >a.foo().n : number ->a.foo() : B ->a.foo : () => B +>a.foo() : import("tests/cases/compiler/f2").B +>a.foo : () => import("tests/cases/compiler/f2").B >a : A ->foo : () => B +>foo : () => import("tests/cases/compiler/f2").B >n : number let c = a.bar().a; diff --git a/tests/baselines/reference/moduleAugmentationImportsAndExports6.types b/tests/baselines/reference/moduleAugmentationImportsAndExports6.types index 4457aefb78d..d2778702f58 100644 --- a/tests/baselines/reference/moduleAugmentationImportsAndExports6.types +++ b/tests/baselines/reference/moduleAugmentationImportsAndExports6.types @@ -81,10 +81,10 @@ let a: A; let b = a.foo().n; >b : number >a.foo().n : number ->a.foo() : B ->a.foo : () => B +>a.foo() : import("tests/cases/compiler/f2").B +>a.foo : () => import("tests/cases/compiler/f2").B >a : A ->foo : () => B +>foo : () => import("tests/cases/compiler/f2").B >n : number let c = a.bar().a; diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule1.types b/tests/baselines/reference/moduleAugmentationInAmbientModule1.types index 428df933b13..478b91f4cef 100644 --- a/tests/baselines/reference/moduleAugmentationInAmbientModule1.types +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule1.types @@ -10,10 +10,10 @@ let x: Observable; x.foo().x; >x.foo().x : number ->x.foo() : Cls ->x.foo : () => Cls +>x.foo() : import("M").Cls +>x.foo : () => import("M").Cls >x : Observable ->foo : () => Cls +>foo : () => import("M").Cls >x : number === tests/cases/compiler/O.d.ts === diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule2.types b/tests/baselines/reference/moduleAugmentationInAmbientModule2.types index 190a8d568b3..e61bc65d71d 100644 --- a/tests/baselines/reference/moduleAugmentationInAmbientModule2.types +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule2.types @@ -11,10 +11,10 @@ let x: Observable; x.foo().x; >x.foo().x : number ->x.foo() : Cls ->x.foo : () => Cls +>x.foo() : import("M").Cls +>x.foo : () => import("M").Cls >x : Observable ->foo : () => Cls +>foo : () => import("M").Cls >x : number === tests/cases/compiler/O.d.ts === diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule3.types b/tests/baselines/reference/moduleAugmentationInAmbientModule3.types index 06efc3c4e86..373ef3a4e9a 100644 --- a/tests/baselines/reference/moduleAugmentationInAmbientModule3.types +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule3.types @@ -11,18 +11,18 @@ let x: Observable; x.foo().x; >x.foo().x : number ->x.foo() : Cls ->x.foo : () => Cls +>x.foo() : import("M").Cls +>x.foo : () => import("M").Cls >x : Observable ->foo : () => Cls +>foo : () => import("M").Cls >x : number x.foo2().x2; >x.foo2().x2 : number ->x.foo2() : Cls2 ->x.foo2 : () => Cls2 +>x.foo2() : import("Map").Cls2 +>x.foo2 : () => import("Map").Cls2 >x : Observable ->foo2 : () => Cls2 +>foo2 : () => import("Map").Cls2 >x2 : number === tests/cases/compiler/O.d.ts === diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule4.types b/tests/baselines/reference/moduleAugmentationInAmbientModule4.types index bdb2501ac8c..c9849455be2 100644 --- a/tests/baselines/reference/moduleAugmentationInAmbientModule4.types +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule4.types @@ -12,18 +12,18 @@ let x: Observable; x.foo().x; >x.foo().x : number ->x.foo() : Cls ->x.foo : () => Cls +>x.foo() : import("M").Cls +>x.foo : () => import("M").Cls >x : Observable ->foo : () => Cls +>foo : () => import("M").Cls >x : number x.foo2().x2; >x.foo2().x2 : number ->x.foo2() : Cls2 ->x.foo2 : () => Cls2 +>x.foo2() : import("Map").Cls2 +>x.foo2 : () => import("Map").Cls2 >x : Observable ->foo2 : () => Cls2 +>foo2 : () => import("Map").Cls2 >x2 : number === tests/cases/compiler/O.d.ts === diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule5.types b/tests/baselines/reference/moduleAugmentationInAmbientModule5.types index 82649bd9a6b..94900ecb764 100644 --- a/tests/baselines/reference/moduleAugmentationInAmbientModule5.types +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule5.types @@ -10,10 +10,10 @@ let x = [1]; let y = x.getA().x; >y : number >x.getA().x : number ->x.getA() : A ->x.getA : () => A +>x.getA() : import("A").A +>x.getA : () => import("A").A >x : number[] ->getA : () => A +>getA : () => import("A").A >x : number === tests/cases/compiler/array.d.ts === diff --git a/tests/baselines/reference/moduleAugmentationsBundledOutput1.types b/tests/baselines/reference/moduleAugmentationsBundledOutput1.types index 6c5ebdccdc3..6811e5e729e 100644 --- a/tests/baselines/reference/moduleAugmentationsBundledOutput1.types +++ b/tests/baselines/reference/moduleAugmentationsBundledOutput1.types @@ -150,10 +150,10 @@ c.baz1().x.toExponential(); >c.baz1().x.toExponential() : string >c.baz1().x.toExponential : (fractionDigits?: number) => string >c.baz1().x : number ->c.baz1() : C1 ->c.baz1 : () => C1 +>c.baz1() : import("tests/cases/compiler/m3").C1 +>c.baz1 : () => import("tests/cases/compiler/m3").C1 >c : Cls ->baz1 : () => C1 +>baz1 : () => import("tests/cases/compiler/m3").C1 >x : number >toExponential : (fractionDigits?: number) => string @@ -161,10 +161,10 @@ c.baz2().x.toLowerCase(); >c.baz2().x.toLowerCase() : string >c.baz2().x.toLowerCase : () => string >c.baz2().x : string ->c.baz2() : C2 ->c.baz2 : () => C2 +>c.baz2() : import("tests/cases/compiler/m3").C2 +>c.baz2 : () => import("tests/cases/compiler/m3").C2 >c : Cls ->baz2 : () => C2 +>baz2 : () => import("tests/cases/compiler/m3").C2 >x : string >toLowerCase : () => string diff --git a/tests/baselines/reference/moduleAugmentationsImports1.types b/tests/baselines/reference/moduleAugmentationsImports1.types index 9df5d5b72d4..c935a8c1265 100644 --- a/tests/baselines/reference/moduleAugmentationsImports1.types +++ b/tests/baselines/reference/moduleAugmentationsImports1.types @@ -87,10 +87,10 @@ let b = a.getB().x.toFixed(); >a.getB().x.toFixed() : string >a.getB().x.toFixed : (fractionDigits?: number) => string >a.getB().x : number ->a.getB() : B ->a.getB : () => B +>a.getB() : import("tests/cases/compiler/b").B +>a.getB : () => import("tests/cases/compiler/b").B >a : A ->getB : () => B +>getB : () => import("tests/cases/compiler/b").B >x : number >toFixed : (fractionDigits?: number) => string @@ -99,10 +99,10 @@ let c = a.getCls().y.toLowerCase(); >a.getCls().y.toLowerCase() : string >a.getCls().y.toLowerCase : () => string >a.getCls().y : string ->a.getCls() : Cls ->a.getCls : () => Cls +>a.getCls() : import("C").Cls +>a.getCls : () => import("C").Cls >a : A ->getCls : () => Cls +>getCls : () => import("C").Cls >y : string >toLowerCase : () => string diff --git a/tests/baselines/reference/moduleAugmentationsImports2.types b/tests/baselines/reference/moduleAugmentationsImports2.types index c94186c670a..6dc93399b48 100644 --- a/tests/baselines/reference/moduleAugmentationsImports2.types +++ b/tests/baselines/reference/moduleAugmentationsImports2.types @@ -92,10 +92,10 @@ let b = a.getB().x.toFixed(); >a.getB().x.toFixed() : string >a.getB().x.toFixed : (fractionDigits?: number) => string >a.getB().x : number ->a.getB() : B ->a.getB : () => B +>a.getB() : import("tests/cases/compiler/b").B +>a.getB : () => import("tests/cases/compiler/b").B >a : A ->getB : () => B +>getB : () => import("tests/cases/compiler/b").B >x : number >toFixed : (fractionDigits?: number) => string @@ -104,10 +104,10 @@ let c = a.getCls().y.toLowerCase(); >a.getCls().y.toLowerCase() : string >a.getCls().y.toLowerCase : () => string >a.getCls().y : string ->a.getCls() : Cls ->a.getCls : () => Cls +>a.getCls() : import("C").Cls +>a.getCls : () => import("C").Cls >a : A ->getCls : () => Cls +>getCls : () => import("C").Cls >y : string >toLowerCase : () => string diff --git a/tests/baselines/reference/moduleAugmentationsImports3.types b/tests/baselines/reference/moduleAugmentationsImports3.types index 549885a3e0d..a867ee963d2 100644 --- a/tests/baselines/reference/moduleAugmentationsImports3.types +++ b/tests/baselines/reference/moduleAugmentationsImports3.types @@ -15,10 +15,10 @@ let b = a.getB().x.toFixed(); >a.getB().x.toFixed() : string >a.getB().x.toFixed : (fractionDigits?: number) => string >a.getB().x : number ->a.getB() : B ->a.getB : () => B +>a.getB() : import("tests/cases/compiler/b").B +>a.getB : () => import("tests/cases/compiler/b").B >a : A ->getB : () => B +>getB : () => import("tests/cases/compiler/b").B >x : number >toFixed : (fractionDigits?: number) => string @@ -27,10 +27,10 @@ let c = a.getCls().y.toLowerCase(); >a.getCls().y.toLowerCase() : string >a.getCls().y.toLowerCase : () => string >a.getCls().y : string ->a.getCls() : Cls ->a.getCls : () => Cls +>a.getCls() : import("C").Cls +>a.getCls : () => import("C").Cls >a : A ->getCls : () => Cls +>getCls : () => import("C").Cls >y : string >toLowerCase : () => string diff --git a/tests/baselines/reference/moduleAugmentationsImports4.types b/tests/baselines/reference/moduleAugmentationsImports4.types index 530cc5d5619..6fc1802dec1 100644 --- a/tests/baselines/reference/moduleAugmentationsImports4.types +++ b/tests/baselines/reference/moduleAugmentationsImports4.types @@ -16,10 +16,10 @@ let b = a.getB().x.toFixed(); >a.getB().x.toFixed() : string >a.getB().x.toFixed : (fractionDigits?: number) => string >a.getB().x : number ->a.getB() : B ->a.getB : () => B +>a.getB() : import("tests/cases/compiler/b").B +>a.getB : () => import("tests/cases/compiler/b").B >a : A ->getB : () => B +>getB : () => import("tests/cases/compiler/b").B >x : number >toFixed : (fractionDigits?: number) => string @@ -28,10 +28,10 @@ let c = a.getCls().y.toLowerCase(); >a.getCls().y.toLowerCase() : string >a.getCls().y.toLowerCase : () => string >a.getCls().y : string ->a.getCls() : Cls ->a.getCls : () => Cls +>a.getCls() : import("C").Cls +>a.getCls : () => import("C").Cls >a : A ->getCls : () => Cls +>getCls : () => import("C").Cls >y : string >toLowerCase : () => string diff --git a/tests/baselines/reference/moduleDuplicateIdentifiers.types b/tests/baselines/reference/moduleDuplicateIdentifiers.types index ec95d6bbf9d..4019cf50d7e 100644 --- a/tests/baselines/reference/moduleDuplicateIdentifiers.types +++ b/tests/baselines/reference/moduleDuplicateIdentifiers.types @@ -46,7 +46,7 @@ export class Kettle { } export class Kettle { // Should error ->Kettle : Kettle +>Kettle : import("tests/cases/compiler/moduleDuplicateIdentifiers").Kettle member2 = 42; >member2 : number diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks_preserveSymlinks.errors.txt b/tests/baselines/reference/moduleResolutionWithSymlinks_preserveSymlinks.errors.txt index b6459ad4910..3cfa184d7f5 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks_preserveSymlinks.errors.txt +++ b/tests/baselines/reference/moduleResolutionWithSymlinks_preserveSymlinks.errors.txt @@ -1,4 +1,4 @@ -/app/app.ts(9,1): error TS2719: Type 'C' is not assignable to type 'C'. Two different types with this name exist, but they are unrelated. +/app/app.ts(9,1): error TS2322: Type 'import("/app/node_modules/linked2/index").C' is not assignable to type 'import("/app/node_modules/linked/index").C'. Types have separate declarations of a private property 'x'. @@ -13,8 +13,8 @@ // Should fail. We no longer resolve any symlinks. x = new C2(); ~ -!!! error TS2719: Type 'C' is not assignable to type 'C'. Two different types with this name exist, but they are unrelated. -!!! error TS2719: Types have separate declarations of a private property 'x'. +!!! error TS2322: Type 'import("/app/node_modules/linked2/index").C' is not assignable to type 'import("/app/node_modules/linked/index").C'. +!!! error TS2322: Types have separate declarations of a private property 'x'. ==== /linked/index.d.ts (0 errors) ==== export { real } from "real"; diff --git a/tests/baselines/reference/multipleDefaultExports01.types b/tests/baselines/reference/multipleDefaultExports01.types index 175296722ef..3b34a7a5cc8 100644 --- a/tests/baselines/reference/multipleDefaultExports01.types +++ b/tests/baselines/reference/multipleDefaultExports01.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/modules/m1.ts === export default class foo { ->foo : foo +>foo : import("tests/cases/conformance/es6/modules/m1").default } diff --git a/tests/baselines/reference/multipleDefaultExports03.types b/tests/baselines/reference/multipleDefaultExports03.types index 9b03e67897a..a9d31bad4bb 100644 --- a/tests/baselines/reference/multipleDefaultExports03.types +++ b/tests/baselines/reference/multipleDefaultExports03.types @@ -4,5 +4,5 @@ export default class C { } export default class C { ->C : C +>C : import("tests/cases/conformance/es6/modules/multipleDefaultExports03").default } diff --git a/tests/baselines/reference/multipleExportDefault3.types b/tests/baselines/reference/multipleExportDefault3.types index d50c49edccd..9e9eb39ce84 100644 --- a/tests/baselines/reference/multipleExportDefault3.types +++ b/tests/baselines/reference/multipleExportDefault3.types @@ -9,6 +9,6 @@ export default { }; export default class C { } ->C : C +>C : import("tests/cases/conformance/externalModules/multipleExportDefault3").default diff --git a/tests/baselines/reference/multipleExportDefault5.types b/tests/baselines/reference/multipleExportDefault5.types index 838a145bfe7..ab7b3ed9b0c 100644 --- a/tests/baselines/reference/multipleExportDefault5.types +++ b/tests/baselines/reference/multipleExportDefault5.types @@ -3,5 +3,5 @@ export default function bar() { } >bar : () => void export default class C {} ->C : C +>C : import("tests/cases/conformance/externalModules/multipleExportDefault5").default diff --git a/tests/baselines/reference/overrideBaseIntersectionMethod.types b/tests/baselines/reference/overrideBaseIntersectionMethod.types index b5412b18c07..da516abe3d4 100644 --- a/tests/baselines/reference/overrideBaseIntersectionMethod.types +++ b/tests/baselines/reference/overrideBaseIntersectionMethod.types @@ -8,14 +8,14 @@ type Constructor = new (...args: any[]) => T; >T : T const WithLocation = >(Base: T) => class extends Base { ->WithLocation : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T ->>(Base: T) => class extends Base { getLocation(): [number, number] { const [x,y] = super.getLocation(); return [this.x | x, this.y | y]; }} : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T +>WithLocation : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: WithLocation.(Anonymous class); } & T +>>(Base: T) => class extends Base { getLocation(): [number, number] { const [x,y] = super.getLocation(); return [this.x | x, this.y | y]; }} : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: WithLocation.(Anonymous class); } & T >T : T >Constructor : Constructor >Point : Point >Base : T >T : T ->class extends Base { getLocation(): [number, number] { const [x,y] = super.getLocation(); return [this.x | x, this.y | y]; }} : { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T +>class extends Base { getLocation(): [number, number] { const [x,y] = super.getLocation(); return [this.x | x, this.y | y]; }} : { new (...args: any[]): (Anonymous class); prototype: WithLocation.(Anonymous class); } & T >Base : Point getLocation(): [number, number] { @@ -63,8 +63,8 @@ class Point { class Foo extends WithLocation(Point) { >Foo : Foo ->WithLocation(Point) : .(Anonymous class) & Point ->WithLocation : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: .(Anonymous class); } & T +>WithLocation(Point) : WithLocation.(Anonymous class) & Point +>WithLocation : >(Base: T) => { new (...args: any[]): (Anonymous class); prototype: WithLocation.(Anonymous class); } & T >Point : typeof Point calculate() { @@ -85,7 +85,7 @@ class Foo extends WithLocation(Point) { return super.getLocation() >super.getLocation() : [number, number] >super.getLocation : () => [number, number] ->super : .(Anonymous class) & Point +>super : WithLocation.(Anonymous class) & Point >getLocation : () => [number, number] } whereAmI() { diff --git a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt deleted file mode 100644 index f2419b360d6..00000000000 --- a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.errors.txt +++ /dev/null @@ -1,160 +0,0 @@ -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(3,16): error TS4038: Return type of public static getter 'myPublicStaticMethod' from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(9,9): error TS4041: Return type of public getter 'myPublicMethod' from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(15,16): error TS4038: Return type of public static getter 'myPublicStaticMethod1' from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(21,9): error TS4041: Return type of public getter 'myPublicMethod1' from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(57,16): error TS4038: Return type of public static getter 'myPublicStaticMethod' from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(60,9): error TS4041: Return type of public getter 'myPublicMethod' from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(63,16): error TS4038: Return type of public static getter 'myPublicStaticMethod1' from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts(66,9): error TS4041: Return type of public getter 'myPublicMethod1' from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - - -==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_consumer.ts (8 errors) ==== - import exporter = require("./privacyCannotNameAccessorDeclFile_exporter"); - export class publicClassWithWithPrivateGetAccessorTypes { - static get myPublicStaticMethod() { // Error - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS4038: Return type of public static getter 'myPublicStaticMethod' from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget1(); - } - private static get myPrivateStaticMethod() { - return exporter.createExportedWidget1(); - } - get myPublicMethod() { // Error - ~~~~~~~~~~~~~~ -!!! error TS4041: Return type of public getter 'myPublicMethod' from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget1(); - } - private get myPrivateMethod() { - return exporter.createExportedWidget1(); - } - static get myPublicStaticMethod1() { // Error - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4038: Return type of public static getter 'myPublicStaticMethod1' from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget3(); - } - private static get myPrivateStaticMethod1() { - return exporter.createExportedWidget3(); - } - get myPublicMethod1() { // Error - ~~~~~~~~~~~~~~~ -!!! error TS4041: Return type of public getter 'myPublicMethod1' from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget3(); - } - private get myPrivateMethod1() { - return exporter.createExportedWidget3(); - } - } - - class privateClassWithWithPrivateGetAccessorTypes { - static get myPublicStaticMethod() { - return exporter.createExportedWidget1(); - } - private static get myPrivateStaticMethod() { - return exporter.createExportedWidget1(); - } - get myPublicMethod() { - return exporter.createExportedWidget1(); - } - private get myPrivateMethod() { - return exporter.createExportedWidget1(); - } - static get myPublicStaticMethod1() { - return exporter.createExportedWidget3(); - } - private static get myPrivateStaticMethod1() { - return exporter.createExportedWidget3(); - } - get myPublicMethod1() { - return exporter.createExportedWidget3(); - } - private get myPrivateMethod1() { - return exporter.createExportedWidget3(); - } - } - - export class publicClassWithPrivateModuleGetAccessorTypes { - static get myPublicStaticMethod() { // Error - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS4038: Return type of public static getter 'myPublicStaticMethod' from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget2(); - } - get myPublicMethod() { // Error - ~~~~~~~~~~~~~~ -!!! error TS4041: Return type of public getter 'myPublicMethod' from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget2(); - } - static get myPublicStaticMethod1() { // Error - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4038: Return type of public static getter 'myPublicStaticMethod1' from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget4(); - } - get myPublicMethod1() { // Error - ~~~~~~~~~~~~~~~ -!!! error TS4041: Return type of public getter 'myPublicMethod1' from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget4(); - } - } - - class privateClassWithPrivateModuleGetAccessorTypes { - static get myPublicStaticMethod() { - return exporter.createExportedWidget2(); - } - get myPublicMethod() { - return exporter.createExportedWidget2(); - } - static get myPublicStaticMethod1() { - return exporter.createExportedWidget4(); - } - get myPublicMethod1() { - return exporter.createExportedWidget4(); - } - } -==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_GlobalWidgets.ts (0 errors) ==== - declare module "GlobalWidgets" { - export class Widget3 { - name: string; - } - export function createWidget3(): Widget3; - - export module SpecializedGlobalWidget { - export class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets.ts (0 errors) ==== - export class Widget1 { - name = 'one'; - } - export function createWidget1() { - return new Widget1(); - } - - export module SpecializedWidget { - export class Widget2 { - name = 'one'; - } - export function createWidget2() { - return new Widget2(); - } - } - -==== tests/cases/compiler/privacyCannotNameAccessorDeclFile_exporter.ts (0 errors) ==== - /// - import Widgets = require("./privacyCannotNameAccessorDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export function createExportedWidget1() { - return Widgets.createWidget1(); - } - export function createExportedWidget2() { - return Widgets.SpecializedWidget.createWidget2(); - } - export function createExportedWidget3() { - return Widgets1.createWidget3(); - } - export function createExportedWidget4() { - return Widgets1.SpecializedGlobalWidget.createWidget4(); - } - \ No newline at end of file diff --git a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js index 16cc0f6924f..42f76399869 100644 --- a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.js @@ -414,3 +414,21 @@ export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; export declare function createExportedWidget3(): Widgets1.Widget3; export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; +//// [privacyCannotNameAccessorDeclFile_consumer.d.ts] +/// +export declare class publicClassWithWithPrivateGetAccessorTypes { + static readonly myPublicStaticMethod: import("./privacyCannotNameAccessorDeclFile_Widgets").Widget1; + private static readonly myPrivateStaticMethod; + readonly myPublicMethod: import("./privacyCannotNameAccessorDeclFile_Widgets").Widget1; + private readonly myPrivateMethod; + static readonly myPublicStaticMethod1: import("GlobalWidgets").Widget3; + private static readonly myPrivateStaticMethod1; + readonly myPublicMethod1: import("GlobalWidgets").Widget3; + private readonly myPrivateMethod1; +} +export declare class publicClassWithPrivateModuleGetAccessorTypes { + static readonly myPublicStaticMethod: import("./privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2; + readonly myPublicMethod: import("./privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2; + static readonly myPublicStaticMethod1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; + readonly myPublicMethod1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; +} diff --git a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.types b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.types index acff252dad7..bade274b3aa 100644 --- a/tests/baselines/reference/privacyCannotNameAccessorDeclFile.types +++ b/tests/baselines/reference/privacyCannotNameAccessorDeclFile.types @@ -6,76 +6,76 @@ export class publicClassWithWithPrivateGetAccessorTypes { >publicClassWithWithPrivateGetAccessorTypes : publicClassWithWithPrivateGetAccessorTypes static get myPublicStaticMethod() { // Error ->myPublicStaticMethod : Widget1 +>myPublicStaticMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } private static get myPrivateStaticMethod() { ->myPrivateStaticMethod : Widget1 +>myPrivateStaticMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } get myPublicMethod() { // Error ->myPublicMethod : Widget1 +>myPublicMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } private get myPrivateMethod() { ->myPrivateMethod : Widget1 +>myPrivateMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } static get myPublicStaticMethod1() { // Error ->myPublicStaticMethod1 : Widget3 +>myPublicStaticMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private static get myPrivateStaticMethod1() { ->myPrivateStaticMethod1 : Widget3 +>myPrivateStaticMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } get myPublicMethod1() { // Error ->myPublicMethod1 : Widget3 +>myPublicMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private get myPrivateMethod1() { ->myPrivateMethod1 : Widget3 +>myPrivateMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } } @@ -83,76 +83,76 @@ class privateClassWithWithPrivateGetAccessorTypes { >privateClassWithWithPrivateGetAccessorTypes : privateClassWithWithPrivateGetAccessorTypes static get myPublicStaticMethod() { ->myPublicStaticMethod : Widget1 +>myPublicStaticMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } private static get myPrivateStaticMethod() { ->myPrivateStaticMethod : Widget1 +>myPrivateStaticMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } get myPublicMethod() { ->myPublicMethod : Widget1 +>myPublicMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } private get myPrivateMethod() { ->myPrivateMethod : Widget1 +>myPrivateMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").Widget1 } static get myPublicStaticMethod1() { ->myPublicStaticMethod1 : Widget3 +>myPublicStaticMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private static get myPrivateStaticMethod1() { ->myPrivateStaticMethod1 : Widget3 +>myPrivateStaticMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } get myPublicMethod1() { ->myPublicMethod1 : Widget3 +>myPublicMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private get myPrivateMethod1() { ->myPrivateMethod1 : Widget3 +>myPrivateMethod1 : import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } } @@ -160,40 +160,40 @@ export class publicClassWithPrivateModuleGetAccessorTypes { >publicClassWithPrivateModuleGetAccessorTypes : publicClassWithPrivateModuleGetAccessorTypes static get myPublicStaticMethod() { // Error ->myPublicStaticMethod : SpecializedWidget.Widget2 +>myPublicStaticMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 } get myPublicMethod() { // Error ->myPublicMethod : SpecializedWidget.Widget2 +>myPublicMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 } static get myPublicStaticMethod1() { // Error ->myPublicStaticMethod1 : SpecializedGlobalWidget.Widget4 +>myPublicStaticMethod1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } get myPublicMethod1() { // Error ->myPublicMethod1 : SpecializedGlobalWidget.Widget4 +>myPublicMethod1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } } @@ -201,40 +201,40 @@ class privateClassWithPrivateModuleGetAccessorTypes { >privateClassWithPrivateModuleGetAccessorTypes : privateClassWithPrivateModuleGetAccessorTypes static get myPublicStaticMethod() { ->myPublicStaticMethod : SpecializedWidget.Widget2 +>myPublicStaticMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 } get myPublicMethod() { ->myPublicMethod : SpecializedWidget.Widget2 +>myPublicMethod : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameAccessorDeclFile_Widgets").SpecializedWidget.Widget2 } static get myPublicStaticMethod1() { ->myPublicStaticMethod1 : SpecializedGlobalWidget.Widget4 +>myPublicStaticMethod1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } get myPublicMethod1() { ->myPublicMethod1 : SpecializedGlobalWidget.Widget4 +>myPublicMethod1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } } === tests/cases/compiler/privacyCannotNameAccessorDeclFile_GlobalWidgets.ts === diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt deleted file mode 100644 index 0596281df44..00000000000 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.errors.txt +++ /dev/null @@ -1,135 +0,0 @@ -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(3,12): error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(5,5): error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(8,12): error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(10,5): error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(26,12): error TS4023: Exported variable 'publicVarWithPrivatePropertyTypes' has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(28,12): error TS4023: Exported variable 'publicVarWithPrivatePropertyTypes1' has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(32,12): error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(33,5): error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(34,12): error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(35,5): error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(37,12): error TS4023: Exported variable 'publicVarWithPrivateModulePropertyTypes' has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts(38,12): error TS4023: Exported variable 'publicVarWithPrivateModulePropertyTypes1' has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - - -==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_consumer.ts (12 errors) ==== - import exporter = require("./privacyCannotNameVarTypeDeclFile_exporter"); - export class publicClassWithWithPrivatePropertyTypes { - static myPublicStaticProperty = exporter.createExportedWidget1(); // Error - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. - private static myPrivateStaticProperty = exporter.createExportedWidget1(); - myPublicProperty = exporter.createExportedWidget1(); // Error - ~~~~~~~~~~~~~~~~ -!!! error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. - private myPrivateProperty = exporter.createExportedWidget1(); - - static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - private static myPrivateStaticProperty1 = exporter.createExportedWidget3(); - myPublicProperty1 = exporter.createExportedWidget3(); // Error - ~~~~~~~~~~~~~~~~~ -!!! error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - private myPrivateProperty1 = exporter.createExportedWidget3(); - } - - class privateClassWithWithPrivatePropertyTypes { - static myPublicStaticProperty = exporter.createExportedWidget1(); - private static myPrivateStaticProperty = exporter.createExportedWidget1(); - myPublicProperty = exporter.createExportedWidget1(); - private myPrivateProperty = exporter.createExportedWidget1(); - - static myPublicStaticProperty1 = exporter.createExportedWidget3(); - private static myPrivateStaticProperty1 = exporter.createExportedWidget3(); - myPublicProperty1 = exporter.createExportedWidget3(); - private myPrivateProperty1 = exporter.createExportedWidget3(); - } - - export var publicVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4023: Exported variable 'publicVarWithPrivatePropertyTypes' has or is using name 'Widget1' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. - var privateVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); - export var publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4023: Exported variable 'publicVarWithPrivatePropertyTypes1' has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); - - export class publicClassWithPrivateModulePropertyTypes { - static myPublicStaticProperty= exporter.createExportedWidget2(); // Error - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4026: Public static property 'myPublicStaticProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. - myPublicProperty = exporter.createExportedWidget2(); // Error - ~~~~~~~~~~~~~~~~ -!!! error TS4029: Public property 'myPublicProperty' of exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. - static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4026: Public static property 'myPublicStaticProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - myPublicProperty1 = exporter.createExportedWidget4(); // Error - ~~~~~~~~~~~~~~~~~ -!!! error TS4029: Public property 'myPublicProperty1' of exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - } - export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4023: Exported variable 'publicVarWithPrivateModulePropertyTypes' has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets" but cannot be named. - export var publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4023: Exported variable 'publicVarWithPrivateModulePropertyTypes1' has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - - class privateClassWithPrivateModulePropertyTypes { - static myPublicStaticProperty= exporter.createExportedWidget2(); - myPublicProperty= exporter.createExportedWidget2(); - static myPublicStaticProperty1 = exporter.createExportedWidget4(); - myPublicProperty1 = exporter.createExportedWidget4(); - } - var privateVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); - var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); -==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts (0 errors) ==== - declare module "GlobalWidgets" { - export class Widget3 { - name: string; - } - export function createWidget3(): Widget3; - - export module SpecializedGlobalWidget { - export class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets.ts (0 errors) ==== - export class Widget1 { - name = 'one'; - } - export function createWidget1() { - return new Widget1(); - } - - export module SpecializedWidget { - export class Widget2 { - name = 'one'; - } - export function createWidget2() { - return new Widget2(); - } - } - -==== tests/cases/compiler/privacyCannotNameVarTypeDeclFile_exporter.ts (0 errors) ==== - /// - import Widgets = require("./privacyCannotNameVarTypeDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export function createExportedWidget1() { - return Widgets.createWidget1(); - } - export function createExportedWidget2() { - return Widgets.SpecializedWidget.createWidget2(); - } - export function createExportedWidget3() { - return Widgets1.createWidget3(); - } - export function createExportedWidget4() { - return Widgets1.SpecializedGlobalWidget.createWidget4(); - } - \ No newline at end of file diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js index ba519bb081a..80c9e0157ee 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.js @@ -241,3 +241,25 @@ export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; export declare function createExportedWidget3(): Widgets1.Widget3; export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; +//// [privacyCannotNameVarTypeDeclFile_consumer.d.ts] +/// +export declare class publicClassWithWithPrivatePropertyTypes { + static myPublicStaticProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").Widget1; + private static myPrivateStaticProperty; + myPublicProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").Widget1; + private myPrivateProperty; + static myPublicStaticProperty1: import("GlobalWidgets").Widget3; + private static myPrivateStaticProperty1; + myPublicProperty1: import("GlobalWidgets").Widget3; + private myPrivateProperty1; +} +export declare var publicVarWithPrivatePropertyTypes: import("./privacyCannotNameVarTypeDeclFile_Widgets").Widget1; +export declare var publicVarWithPrivatePropertyTypes1: import("GlobalWidgets").Widget3; +export declare class publicClassWithPrivateModulePropertyTypes { + static myPublicStaticProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2; + myPublicProperty: import("./privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2; + static myPublicStaticProperty1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; + myPublicProperty1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; +} +export declare var publicVarWithPrivateModulePropertyTypes: import("./privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2; +export declare var publicVarWithPrivateModulePropertyTypes1: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; diff --git a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.types b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.types index 0263f5c82f3..36b6760be0f 100644 --- a/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.types +++ b/tests/baselines/reference/privacyCannotNameVarTypeDeclFile.types @@ -6,239 +6,239 @@ export class publicClassWithWithPrivatePropertyTypes { >publicClassWithWithPrivatePropertyTypes : publicClassWithWithPrivatePropertyTypes static myPublicStaticProperty = exporter.createExportedWidget1(); // Error ->myPublicStaticProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicStaticProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 private static myPrivateStaticProperty = exporter.createExportedWidget1(); ->myPrivateStaticProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateStaticProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 myPublicProperty = exporter.createExportedWidget1(); // Error ->myPublicProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 private myPrivateProperty = exporter.createExportedWidget1(); ->myPrivateProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 static myPublicStaticProperty1 = exporter.createExportedWidget3(); // Error ->myPublicStaticProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicStaticProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 private static myPrivateStaticProperty1 = exporter.createExportedWidget3(); ->myPrivateStaticProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateStaticProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 myPublicProperty1 = exporter.createExportedWidget3(); // Error ->myPublicProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 private myPrivateProperty1 = exporter.createExportedWidget3(); ->myPrivateProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } class privateClassWithWithPrivatePropertyTypes { >privateClassWithWithPrivatePropertyTypes : privateClassWithWithPrivatePropertyTypes static myPublicStaticProperty = exporter.createExportedWidget1(); ->myPublicStaticProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicStaticProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 private static myPrivateStaticProperty = exporter.createExportedWidget1(); ->myPrivateStaticProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateStaticProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 myPublicProperty = exporter.createExportedWidget1(); ->myPublicProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 private myPrivateProperty = exporter.createExportedWidget1(); ->myPrivateProperty : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 static myPublicStaticProperty1 = exporter.createExportedWidget3(); ->myPublicStaticProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicStaticProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 private static myPrivateStaticProperty1 = exporter.createExportedWidget3(); ->myPrivateStaticProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateStaticProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 myPublicProperty1 = exporter.createExportedWidget3(); ->myPublicProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 private myPrivateProperty1 = exporter.createExportedWidget3(); ->myPrivateProperty1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateProperty1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } export var publicVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); // Error ->publicVarWithPrivatePropertyTypes : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>publicVarWithPrivatePropertyTypes : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 var privateVarWithPrivatePropertyTypes= exporter.createExportedWidget1(); ->privateVarWithPrivatePropertyTypes : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>privateVarWithPrivatePropertyTypes : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").Widget1 export var publicVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); // Error ->publicVarWithPrivatePropertyTypes1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>publicVarWithPrivatePropertyTypes1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 var privateVarWithPrivatePropertyTypes1 = exporter.createExportedWidget3(); ->privateVarWithPrivatePropertyTypes1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>privateVarWithPrivatePropertyTypes1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 export class publicClassWithPrivateModulePropertyTypes { >publicClassWithPrivateModulePropertyTypes : publicClassWithPrivateModulePropertyTypes static myPublicStaticProperty= exporter.createExportedWidget2(); // Error ->myPublicStaticProperty : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicStaticProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 myPublicProperty = exporter.createExportedWidget2(); // Error ->myPublicProperty : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 static myPublicStaticProperty1 = exporter.createExportedWidget4(); // Error ->myPublicStaticProperty1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicStaticProperty1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 myPublicProperty1 = exporter.createExportedWidget4(); // Error ->myPublicProperty1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicProperty1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } export var publicVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); // Error ->publicVarWithPrivateModulePropertyTypes : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>publicVarWithPrivateModulePropertyTypes : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 export var publicVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); // Error ->publicVarWithPrivateModulePropertyTypes1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>publicVarWithPrivateModulePropertyTypes1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 class privateClassWithPrivateModulePropertyTypes { >privateClassWithPrivateModulePropertyTypes : privateClassWithPrivateModulePropertyTypes static myPublicStaticProperty= exporter.createExportedWidget2(); ->myPublicStaticProperty : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicStaticProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 myPublicProperty= exporter.createExportedWidget2(); ->myPublicProperty : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicProperty : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 static myPublicStaticProperty1 = exporter.createExportedWidget4(); ->myPublicStaticProperty1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicStaticProperty1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 myPublicProperty1 = exporter.createExportedWidget4(); ->myPublicProperty1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicProperty1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } var privateVarWithPrivateModulePropertyTypes= exporter.createExportedWidget2(); ->privateVarWithPrivateModulePropertyTypes : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>privateVarWithPrivateModulePropertyTypes : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyCannotNameVarTypeDeclFile_Widgets").SpecializedWidget.Widget2 var privateVarWithPrivateModulePropertyTypes1 = exporter.createExportedWidget4(); ->privateVarWithPrivateModulePropertyTypes1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>privateVarWithPrivateModulePropertyTypes1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 === tests/cases/compiler/privacyCannotNameVarTypeDeclFile_GlobalWidgets.ts === declare module "GlobalWidgets" { diff --git a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt deleted file mode 100644 index 432e209eaa8..00000000000 --- a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.errors.txt +++ /dev/null @@ -1,227 +0,0 @@ -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(3,33): error TS4068: Parameter 'param' of public static method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(7,20): error TS4071: Parameter 'param' of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(11,17): error TS4061: Parameter 'param' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(11,59): error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(11,110): error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(15,33): error TS4068: Parameter 'param' of public static method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(19,20): error TS4071: Parameter 'param' of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(23,17): error TS4061: Parameter 'param' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(23,59): error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(23,110): error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(52,56): error TS4076: Parameter 'param' of exported function has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(56,57): error TS4076: Parameter 'param' of exported function has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(63,33): error TS4068: Parameter 'param' of public static method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(65,20): error TS4071: Parameter 'param' of public method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(67,17): error TS4061: Parameter 'param' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(67,58): error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(67,108): error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(71,33): error TS4068: Parameter 'param' of public static method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(73,20): error TS4071: Parameter 'param' of public method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(75,17): error TS4061: Parameter 'param' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(75,58): error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(75,108): error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(78,63): error TS4076: Parameter 'param' of exported function has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts(80,64): error TS4076: Parameter 'param' of exported function has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - - -==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_consumer.ts (24 errors) ==== - import exporter = require("./privacyFunctionCannotNameParameterTypeDeclFile_exporter"); - export class publicClassWithWithPrivateParmeterTypes { - static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4068: Parameter 'param' of public static method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) { - } - myPublicMethod(param = exporter.createExportedWidget1()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4071: Parameter 'param' of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - private myPrivateMethod(param = exporter.createExportedWidget1()) { - } - constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - } - export class publicClassWithWithPrivateParmeterTypes1 { - static myPublicStaticMethod(param = exporter.createExportedWidget3()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4068: Parameter 'param' of public static method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - } - private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) { - } - myPublicMethod(param = exporter.createExportedWidget3()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4071: Parameter 'param' of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - } - private myPrivateMethod(param = exporter.createExportedWidget3()) { - } - constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - } - } - - class privateClassWithWithPrivateParmeterTypes { - static myPublicStaticMethod(param = exporter.createExportedWidget1()) { - } - private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) { - } - myPublicMethod(param = exporter.createExportedWidget1()) { - } - private myPrivateMethod(param = exporter.createExportedWidget1()) { - } - constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { - } - } - class privateClassWithWithPrivateParmeterTypes2 { - static myPublicStaticMethod(param = exporter.createExportedWidget3()) { - } - private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) { - } - myPublicMethod(param = exporter.createExportedWidget3()) { - } - private myPrivateMethod(param = exporter.createExportedWidget3()) { - } - constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { - } - } - - export function publicFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4076: Parameter 'param' of exported function has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - function privateFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { - } - export function publicFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4076: Parameter 'param' of exported function has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - } - function privateFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { - } - - - export class publicClassWithPrivateModuleParameterTypes { - static myPublicStaticMethod(param= exporter.createExportedWidget2()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4068: Parameter 'param' of public static method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - myPublicMethod(param= exporter.createExportedWidget2()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4071: Parameter 'param' of public method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - } - export class publicClassWithPrivateModuleParameterTypes2 { - static myPublicStaticMethod(param= exporter.createExportedWidget4()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4068: Parameter 'param' of public static method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - } - myPublicMethod(param= exporter.createExportedWidget4()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4071: Parameter 'param' of public method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - } - constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param1' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4061: Parameter 'param2' of constructor from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - } - } - export function publicFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4076: Parameter 'param' of exported function has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets" but cannot be named. - } - export function publicFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4076: Parameter 'param' of exported function has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - } - - - class privateClassWithPrivateModuleParameterTypes { - static myPublicStaticMethod(param= exporter.createExportedWidget2()) { - } - myPublicMethod(param= exporter.createExportedWidget2()) { - } - constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { - } - } - class privateClassWithPrivateModuleParameterTypes1 { - static myPublicStaticMethod(param= exporter.createExportedWidget4()) { - } - myPublicMethod(param= exporter.createExportedWidget4()) { - } - constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { - } - } - function privateFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { - } - function privateFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { - } -==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts (0 errors) ==== - declare module "GlobalWidgets" { - export class Widget3 { - name: string; - } - export function createWidget3(): Widget3; - - export module SpecializedGlobalWidget { - export class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets.ts (0 errors) ==== - export class Widget1 { - name = 'one'; - } - export function createWidget1() { - return new Widget1(); - } - - export module SpecializedWidget { - export class Widget2 { - name = 'one'; - } - export function createWidget2() { - return new Widget2(); - } - } - -==== tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_exporter.ts (0 errors) ==== - /// - import Widgets = require("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export function createExportedWidget1() { - return Widgets.createWidget1(); - } - export function createExportedWidget2() { - return Widgets.SpecializedWidget.createWidget2(); - } - export function createExportedWidget3() { - return Widgets1.createWidget3(); - } - export function createExportedWidget4() { - return Widgets1.SpecializedGlobalWidget.createWidget4(); - } - \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js index 3a61785c7f7..c0cc5b584c9 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js +++ b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.js @@ -427,3 +427,41 @@ export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; export declare function createExportedWidget3(): Widgets1.Widget3; export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; +//// [privacyFunctionCannotNameParameterTypeDeclFile_consumer.d.ts] +/// +export declare class publicClassWithWithPrivateParmeterTypes { + private param1; + param2: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1; + static myPublicStaticMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1): void; + private static myPrivateStaticMethod; + myPublicMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1): void; + private myPrivateMethod; + constructor(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1, param1?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1, param2?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1); +} +export declare class publicClassWithWithPrivateParmeterTypes1 { + private param1; + param2: import("GlobalWidgets").Widget3; + static myPublicStaticMethod(param?: import("GlobalWidgets").Widget3): void; + private static myPrivateStaticMethod; + myPublicMethod(param?: import("GlobalWidgets").Widget3): void; + private myPrivateMethod; + constructor(param?: import("GlobalWidgets").Widget3, param1?: import("GlobalWidgets").Widget3, param2?: import("GlobalWidgets").Widget3); +} +export declare function publicFunctionWithPrivateParmeterTypes(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1): void; +export declare function publicFunctionWithPrivateParmeterTypes1(param?: import("GlobalWidgets").Widget3): void; +export declare class publicClassWithPrivateModuleParameterTypes { + private param1; + param2: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2; + static myPublicStaticMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2): void; + myPublicMethod(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2): void; + constructor(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2, param1?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2, param2?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2); +} +export declare class publicClassWithPrivateModuleParameterTypes2 { + private param1; + param2: import("GlobalWidgets").SpecializedGlobalWidget.Widget4; + static myPublicStaticMethod(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4): void; + myPublicMethod(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4): void; + constructor(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4, param1?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4, param2?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4); +} +export declare function publicFunctionWithPrivateModuleParameterTypes(param?: import("./privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2): void; +export declare function publicFunctionWithPrivateModuleParameterTypes1(param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4): void; diff --git a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.types b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.types index 7c9147180f3..7f9f9493e3e 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.types +++ b/tests/baselines/reference/privacyFunctionCannotNameParameterTypeDeclFile.types @@ -6,106 +6,106 @@ export class publicClassWithWithPrivateParmeterTypes { >publicClassWithWithPrivateParmeterTypes : publicClassWithWithPrivateParmeterTypes static myPublicStaticMethod(param = exporter.createExportedWidget1()) { // Error ->myPublicStaticMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicStaticMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) { ->myPrivateStaticMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateStaticMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } myPublicMethod(param = exporter.createExportedWidget1()) { // Error ->myPublicMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } private myPrivateMethod(param = exporter.createExportedWidget1()) { ->myPrivateMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { // Error ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 ->param1 : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>param1 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 ->param2 : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>param2 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } } export class publicClassWithWithPrivateParmeterTypes1 { >publicClassWithWithPrivateParmeterTypes1 : publicClassWithWithPrivateParmeterTypes1 static myPublicStaticMethod(param = exporter.createExportedWidget3()) { // Error ->myPublicStaticMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicStaticMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) { ->myPrivateStaticMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateStaticMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } myPublicMethod(param = exporter.createExportedWidget3()) { // Error ->myPublicMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private myPrivateMethod(param = exporter.createExportedWidget3()) { ->myPrivateMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { // Error ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 ->param1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 +>param1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 ->param2 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 +>param2 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } } @@ -113,140 +113,140 @@ class privateClassWithWithPrivateParmeterTypes { >privateClassWithWithPrivateParmeterTypes : privateClassWithWithPrivateParmeterTypes static myPublicStaticMethod(param = exporter.createExportedWidget1()) { ->myPublicStaticMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicStaticMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } private static myPrivateStaticMethod(param = exporter.createExportedWidget1()) { ->myPrivateStaticMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateStaticMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } myPublicMethod(param = exporter.createExportedWidget1()) { ->myPublicMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPublicMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } private myPrivateMethod(param = exporter.createExportedWidget1()) { ->myPrivateMethod : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>myPrivateMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } constructor(param = exporter.createExportedWidget1(), private param1 = exporter.createExportedWidget1(), public param2 = exporter.createExportedWidget1()) { ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 ->param1 : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>param1 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 ->param2 : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>param2 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } } class privateClassWithWithPrivateParmeterTypes2 { >privateClassWithWithPrivateParmeterTypes2 : privateClassWithWithPrivateParmeterTypes2 static myPublicStaticMethod(param = exporter.createExportedWidget3()) { ->myPublicStaticMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicStaticMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private static myPrivateStaticMethod(param = exporter.createExportedWidget3()) { ->myPrivateStaticMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateStaticMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } myPublicMethod(param = exporter.createExportedWidget3()) { ->myPublicMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPublicMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private myPrivateMethod(param = exporter.createExportedWidget3()) { ->myPrivateMethod : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>myPrivateMethod : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } constructor(param = exporter.createExportedWidget3(), private param1 = exporter.createExportedWidget3(), public param2 = exporter.createExportedWidget3()) { ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 ->param1 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 +>param1 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 ->param2 : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 +>param2 : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } } export function publicFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { // Error ->publicFunctionWithPrivateParmeterTypes : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>publicFunctionWithPrivateParmeterTypes : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } function privateFunctionWithPrivateParmeterTypes(param = exporter.createExportedWidget1()) { ->privateFunctionWithPrivateParmeterTypes : (param?: Widget1) => void ->param : Widget1 ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>privateFunctionWithPrivateParmeterTypes : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").Widget1 } export function publicFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { // Error ->publicFunctionWithPrivateParmeterTypes1 : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>publicFunctionWithPrivateParmeterTypes1 : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } function privateFunctionWithPrivateParmeterTypes1(param = exporter.createExportedWidget3()) { ->privateFunctionWithPrivateParmeterTypes1 : (param?: Widget3) => void ->param : Widget3 ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>privateFunctionWithPrivateParmeterTypes1 : (param?: import("GlobalWidgets").Widget3) => void +>param : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } @@ -254,91 +254,91 @@ export class publicClassWithPrivateModuleParameterTypes { >publicClassWithPrivateModuleParameterTypes : publicClassWithPrivateModuleParameterTypes static myPublicStaticMethod(param= exporter.createExportedWidget2()) { // Error ->myPublicStaticMethod : (param?: SpecializedWidget.Widget2) => void ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicStaticMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } myPublicMethod(param= exporter.createExportedWidget2()) { // Error ->myPublicMethod : (param?: SpecializedWidget.Widget2) => void ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { // Error ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 ->param1 : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>param1 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 ->param2 : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>param2 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } } export class publicClassWithPrivateModuleParameterTypes2 { >publicClassWithPrivateModuleParameterTypes2 : publicClassWithPrivateModuleParameterTypes2 static myPublicStaticMethod(param= exporter.createExportedWidget4()) { // Error ->myPublicStaticMethod : (param?: SpecializedGlobalWidget.Widget4) => void ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicStaticMethod : (param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4) => void +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } myPublicMethod(param= exporter.createExportedWidget4()) { // Error ->myPublicMethod : (param?: SpecializedGlobalWidget.Widget4) => void ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicMethod : (param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4) => void +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { // Error ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 ->param1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>param1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 ->param2 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>param2 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } } export function publicFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { // Error ->publicFunctionWithPrivateModuleParameterTypes : (param?: SpecializedWidget.Widget2) => void ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>publicFunctionWithPrivateModuleParameterTypes : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } export function publicFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { // Error ->publicFunctionWithPrivateModuleParameterTypes1 : (param?: SpecializedGlobalWidget.Widget4) => void ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>publicFunctionWithPrivateModuleParameterTypes1 : (param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4) => void +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } @@ -346,91 +346,91 @@ class privateClassWithPrivateModuleParameterTypes { >privateClassWithPrivateModuleParameterTypes : privateClassWithPrivateModuleParameterTypes static myPublicStaticMethod(param= exporter.createExportedWidget2()) { ->myPublicStaticMethod : (param?: SpecializedWidget.Widget2) => void ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicStaticMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } myPublicMethod(param= exporter.createExportedWidget2()) { ->myPublicMethod : (param?: SpecializedWidget.Widget2) => void ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>myPublicMethod : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } constructor(param= exporter.createExportedWidget2(), private param1= exporter.createExportedWidget2(), public param2= exporter.createExportedWidget2()) { ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 ->param1 : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>param1 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 ->param2 : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>param2 : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } } class privateClassWithPrivateModuleParameterTypes1 { >privateClassWithPrivateModuleParameterTypes1 : privateClassWithPrivateModuleParameterTypes1 static myPublicStaticMethod(param= exporter.createExportedWidget4()) { ->myPublicStaticMethod : (param?: SpecializedGlobalWidget.Widget4) => void ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicStaticMethod : (param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4) => void +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } myPublicMethod(param= exporter.createExportedWidget4()) { ->myPublicMethod : (param?: SpecializedGlobalWidget.Widget4) => void ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>myPublicMethod : (param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4) => void +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } constructor(param= exporter.createExportedWidget4(), private param1= exporter.createExportedWidget4(), public param2= exporter.createExportedWidget4()) { ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 ->param1 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>param1 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 ->param2 : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>param2 : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } } function privateFunctionWithPrivateModuleParameterTypes(param= exporter.createExportedWidget2()) { ->privateFunctionWithPrivateModuleParameterTypes : (param?: SpecializedWidget.Widget2) => void ->param : SpecializedWidget.Widget2 ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>privateFunctionWithPrivateModuleParameterTypes : (param?: import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2) => void +>param : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_Widgets").SpecializedWidget.Widget2 } function privateFunctionWithPrivateModuleParameterTypes1(param= exporter.createExportedWidget4()) { ->privateFunctionWithPrivateModuleParameterTypes1 : (param?: SpecializedGlobalWidget.Widget4) => void ->param : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>privateFunctionWithPrivateModuleParameterTypes1 : (param?: import("GlobalWidgets").SpecializedGlobalWidget.Widget4) => void +>param : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } === tests/cases/compiler/privacyFunctionCannotNameParameterTypeDeclFile_GlobalWidgets.ts === declare module "GlobalWidgets" { diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt deleted file mode 100644 index 1a915d8b82c..00000000000 --- a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.errors.txt +++ /dev/null @@ -1,198 +0,0 @@ -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(3,12): error TS4050: Return type of public static method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(9,5): error TS4053: Return type of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(15,12): error TS4050: Return type of public static method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(21,5): error TS4053: Return type of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(56,17): error TS4058: Return type of exported function has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(62,17): error TS4058: Return type of exported function has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(70,12): error TS4050: Return type of public static method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(73,5): error TS4053: Return type of public method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(76,12): error TS4050: Return type of public static method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(79,5): error TS4053: Return type of public method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(83,17): error TS4058: Return type of exported function has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. -tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts(86,17): error TS4058: Return type of exported function has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - - -==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_consumer.ts (12 errors) ==== - import exporter = require("./privacyFunctionReturnTypeDeclFile_exporter"); - export class publicClassWithWithPrivateParmeterTypes { - static myPublicStaticMethod() { // Error - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS4050: Return type of public static method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget1(); - } - private static myPrivateStaticMethod() { - return exporter.createExportedWidget1();; - } - myPublicMethod() { // Error - ~~~~~~~~~~~~~~ -!!! error TS4053: Return type of public method from exported class has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget1();; - } - private myPrivateMethod() { - return exporter.createExportedWidget1();; - } - static myPublicStaticMethod1() { // Error - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4050: Return type of public static method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget3(); - } - private static myPrivateStaticMethod1() { - return exporter.createExportedWidget3();; - } - myPublicMethod1() { // Error - ~~~~~~~~~~~~~~~ -!!! error TS4053: Return type of public method from exported class has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget3();; - } - private myPrivateMethod1() { - return exporter.createExportedWidget3();; - } - } - - class privateClassWithWithPrivateParmeterTypes { - static myPublicStaticMethod() { - return exporter.createExportedWidget1(); - } - private static myPrivateStaticMethod() { - return exporter.createExportedWidget1();; - } - myPublicMethod() { - return exporter.createExportedWidget1();; - } - private myPrivateMethod() { - return exporter.createExportedWidget1();; - } - static myPublicStaticMethod1() { - return exporter.createExportedWidget3(); - } - private static myPrivateStaticMethod1() { - return exporter.createExportedWidget3();; - } - myPublicMethod1() { - return exporter.createExportedWidget3();; - } - private myPrivateMethod1() { - return exporter.createExportedWidget3();; - } - } - - export function publicFunctionWithPrivateParmeterTypes() { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4058: Return type of exported function has or is using name 'Widget1' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget1(); - } - function privateFunctionWithPrivateParmeterTypes() { - return exporter.createExportedWidget1(); - } - export function publicFunctionWithPrivateParmeterTypes1() { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4058: Return type of exported function has or is using name 'Widget3' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget3(); - } - function privateFunctionWithPrivateParmeterTypes1() { - return exporter.createExportedWidget3(); - } - - export class publicClassWithPrivateModuleReturnTypes { - static myPublicStaticMethod() { // Error - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS4050: Return type of public static method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget2(); - } - myPublicMethod() { // Error - ~~~~~~~~~~~~~~ -!!! error TS4053: Return type of public method from exported class has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget2(); - } - static myPublicStaticMethod1() { // Error - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4050: Return type of public static method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget4(); - } - myPublicMethod1() { // Error - ~~~~~~~~~~~~~~~ -!!! error TS4053: Return type of public method from exported class has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget4(); - } - } - export function publicFunctionWithPrivateModuleReturnTypes() { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4058: Return type of exported function has or is using name 'SpecializedWidget.Widget2' from external module "tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets" but cannot be named. - return exporter.createExportedWidget2(); - } - export function publicFunctionWithPrivateModuleReturnTypes1() { // Error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4058: Return type of exported function has or is using name 'SpecializedGlobalWidget.Widget4' from external module "GlobalWidgets" but cannot be named. - return exporter.createExportedWidget4(); - } - - class privateClassWithPrivateModuleReturnTypes { - static myPublicStaticMethod() { - return exporter.createExportedWidget2(); - } - myPublicMethod() { - return exporter.createExportedWidget2(); - } - static myPublicStaticMethod1() { // Error - return exporter.createExportedWidget4(); - } - myPublicMethod1() { // Error - return exporter.createExportedWidget4(); - } - } - function privateFunctionWithPrivateModuleReturnTypes() { - return exporter.createExportedWidget2(); - } - function privateFunctionWithPrivateModuleReturnTypes1() { - return exporter.createExportedWidget4(); - } - -==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts (0 errors) ==== - declare module "GlobalWidgets" { - export class Widget3 { - name: string; - } - export function createWidget3(): Widget3; - - export module SpecializedGlobalWidget { - export class Widget4 { - name: string; - } - function createWidget4(): Widget4; - } - } - -==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets.ts (0 errors) ==== - export class Widget1 { - name = 'one'; - } - export function createWidget1() { - return new Widget1(); - } - - export module SpecializedWidget { - export class Widget2 { - name = 'one'; - } - export function createWidget2() { - return new Widget2(); - } - } - -==== tests/cases/compiler/privacyFunctionReturnTypeDeclFile_exporter.ts (0 errors) ==== - /// - import Widgets = require("./privacyFunctionReturnTypeDeclFile_Widgets"); - import Widgets1 = require("GlobalWidgets"); - export function createExportedWidget1() { - return Widgets.createWidget1(); - } - export function createExportedWidget2() { - return Widgets.SpecializedWidget.createWidget2(); - } - export function createExportedWidget3() { - return Widgets1.createWidget3(); - } - export function createExportedWidget4() { - return Widgets1.SpecializedGlobalWidget.createWidget4(); - } - \ No newline at end of file diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js index d6e9f526697..bde8a71b7c8 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js +++ b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.js @@ -384,3 +384,25 @@ export declare function createExportedWidget1(): Widgets.Widget1; export declare function createExportedWidget2(): Widgets.SpecializedWidget.Widget2; export declare function createExportedWidget3(): Widgets1.Widget3; export declare function createExportedWidget4(): Widgets1.SpecializedGlobalWidget.Widget4; +//// [privacyFunctionReturnTypeDeclFile_consumer.d.ts] +/// +export declare class publicClassWithWithPrivateParmeterTypes { + static myPublicStaticMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").Widget1; + private static myPrivateStaticMethod; + myPublicMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").Widget1; + private myPrivateMethod; + static myPublicStaticMethod1(): import("GlobalWidgets").Widget3; + private static myPrivateStaticMethod1; + myPublicMethod1(): import("GlobalWidgets").Widget3; + private myPrivateMethod1; +} +export declare function publicFunctionWithPrivateParmeterTypes(): import("./privacyFunctionReturnTypeDeclFile_Widgets").Widget1; +export declare function publicFunctionWithPrivateParmeterTypes1(): import("GlobalWidgets").Widget3; +export declare class publicClassWithPrivateModuleReturnTypes { + static myPublicStaticMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2; + myPublicMethod(): import("./privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2; + static myPublicStaticMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; + myPublicMethod1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; +} +export declare function publicFunctionWithPrivateModuleReturnTypes(): import("./privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2; +export declare function publicFunctionWithPrivateModuleReturnTypes1(): import("GlobalWidgets").SpecializedGlobalWidget.Widget4; diff --git a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.types b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.types index a5de70a04e9..35a2db59209 100644 --- a/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.types +++ b/tests/baselines/reference/privacyFunctionCannotNameReturnTypeDeclFile.types @@ -6,76 +6,76 @@ export class publicClassWithWithPrivateParmeterTypes { >publicClassWithWithPrivateParmeterTypes : publicClassWithWithPrivateParmeterTypes static myPublicStaticMethod() { // Error ->myPublicStaticMethod : () => Widget1 +>myPublicStaticMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } private static myPrivateStaticMethod() { ->myPrivateStaticMethod : () => Widget1 +>myPrivateStaticMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1();; ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } myPublicMethod() { // Error ->myPublicMethod : () => Widget1 +>myPublicMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1();; ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } private myPrivateMethod() { ->myPrivateMethod : () => Widget1 +>myPrivateMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1();; ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } static myPublicStaticMethod1() { // Error ->myPublicStaticMethod1 : () => Widget3 +>myPublicStaticMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private static myPrivateStaticMethod1() { ->myPrivateStaticMethod1 : () => Widget3 +>myPrivateStaticMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3();; ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } myPublicMethod1() { // Error ->myPublicMethod1 : () => Widget3 +>myPublicMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3();; ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private myPrivateMethod1() { ->myPrivateMethod1 : () => Widget3 +>myPrivateMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3();; ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } } @@ -83,232 +83,232 @@ class privateClassWithWithPrivateParmeterTypes { >privateClassWithWithPrivateParmeterTypes : privateClassWithWithPrivateParmeterTypes static myPublicStaticMethod() { ->myPublicStaticMethod : () => Widget1 +>myPublicStaticMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } private static myPrivateStaticMethod() { ->myPrivateStaticMethod : () => Widget1 +>myPrivateStaticMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1();; ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } myPublicMethod() { ->myPublicMethod : () => Widget1 +>myPublicMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1();; ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } private myPrivateMethod() { ->myPrivateMethod : () => Widget1 +>myPrivateMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1();; ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } static myPublicStaticMethod1() { ->myPublicStaticMethod1 : () => Widget3 +>myPublicStaticMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private static myPrivateStaticMethod1() { ->myPrivateStaticMethod1 : () => Widget3 +>myPrivateStaticMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3();; ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } myPublicMethod1() { ->myPublicMethod1 : () => Widget3 +>myPublicMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3();; ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } private myPrivateMethod1() { ->myPrivateMethod1 : () => Widget3 +>myPrivateMethod1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3();; ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } } export function publicFunctionWithPrivateParmeterTypes() { // Error ->publicFunctionWithPrivateParmeterTypes : () => Widget1 +>publicFunctionWithPrivateParmeterTypes : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } function privateFunctionWithPrivateParmeterTypes() { ->privateFunctionWithPrivateParmeterTypes : () => Widget1 +>privateFunctionWithPrivateParmeterTypes : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 return exporter.createExportedWidget1(); ->exporter.createExportedWidget1() : Widget1 ->exporter.createExportedWidget1 : () => Widget1 +>exporter.createExportedWidget1() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 +>exporter.createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 >exporter : typeof exporter ->createExportedWidget1 : () => Widget1 +>createExportedWidget1 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").Widget1 } export function publicFunctionWithPrivateParmeterTypes1() { // Error ->publicFunctionWithPrivateParmeterTypes1 : () => Widget3 +>publicFunctionWithPrivateParmeterTypes1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } function privateFunctionWithPrivateParmeterTypes1() { ->privateFunctionWithPrivateParmeterTypes1 : () => Widget3 +>privateFunctionWithPrivateParmeterTypes1 : () => import("GlobalWidgets").Widget3 return exporter.createExportedWidget3(); ->exporter.createExportedWidget3() : Widget3 ->exporter.createExportedWidget3 : () => Widget3 +>exporter.createExportedWidget3() : import("GlobalWidgets").Widget3 +>exporter.createExportedWidget3 : () => import("GlobalWidgets").Widget3 >exporter : typeof exporter ->createExportedWidget3 : () => Widget3 +>createExportedWidget3 : () => import("GlobalWidgets").Widget3 } export class publicClassWithPrivateModuleReturnTypes { >publicClassWithPrivateModuleReturnTypes : publicClassWithPrivateModuleReturnTypes static myPublicStaticMethod() { // Error ->myPublicStaticMethod : () => SpecializedWidget.Widget2 +>myPublicStaticMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 } myPublicMethod() { // Error ->myPublicMethod : () => SpecializedWidget.Widget2 +>myPublicMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 } static myPublicStaticMethod1() { // Error ->myPublicStaticMethod1 : () => SpecializedGlobalWidget.Widget4 +>myPublicStaticMethod1 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } myPublicMethod1() { // Error ->myPublicMethod1 : () => SpecializedGlobalWidget.Widget4 +>myPublicMethod1 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } } export function publicFunctionWithPrivateModuleReturnTypes() { // Error ->publicFunctionWithPrivateModuleReturnTypes : () => SpecializedWidget.Widget2 +>publicFunctionWithPrivateModuleReturnTypes : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 } export function publicFunctionWithPrivateModuleReturnTypes1() { // Error ->publicFunctionWithPrivateModuleReturnTypes1 : () => SpecializedGlobalWidget.Widget4 +>publicFunctionWithPrivateModuleReturnTypes1 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } class privateClassWithPrivateModuleReturnTypes { >privateClassWithPrivateModuleReturnTypes : privateClassWithPrivateModuleReturnTypes static myPublicStaticMethod() { ->myPublicStaticMethod : () => SpecializedWidget.Widget2 +>myPublicStaticMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 } myPublicMethod() { ->myPublicMethod : () => SpecializedWidget.Widget2 +>myPublicMethod : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 } static myPublicStaticMethod1() { // Error ->myPublicStaticMethod1 : () => SpecializedGlobalWidget.Widget4 +>myPublicStaticMethod1 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } myPublicMethod1() { // Error ->myPublicMethod1 : () => SpecializedGlobalWidget.Widget4 +>myPublicMethod1 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } } function privateFunctionWithPrivateModuleReturnTypes() { ->privateFunctionWithPrivateModuleReturnTypes : () => SpecializedWidget.Widget2 +>privateFunctionWithPrivateModuleReturnTypes : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 return exporter.createExportedWidget2(); ->exporter.createExportedWidget2() : SpecializedWidget.Widget2 ->exporter.createExportedWidget2 : () => SpecializedWidget.Widget2 +>exporter.createExportedWidget2() : import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 +>exporter.createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 >exporter : typeof exporter ->createExportedWidget2 : () => SpecializedWidget.Widget2 +>createExportedWidget2 : () => import("tests/cases/compiler/privacyFunctionReturnTypeDeclFile_Widgets").SpecializedWidget.Widget2 } function privateFunctionWithPrivateModuleReturnTypes1() { ->privateFunctionWithPrivateModuleReturnTypes1 : () => SpecializedGlobalWidget.Widget4 +>privateFunctionWithPrivateModuleReturnTypes1 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 return exporter.createExportedWidget4(); ->exporter.createExportedWidget4() : SpecializedGlobalWidget.Widget4 ->exporter.createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4() : import("GlobalWidgets").SpecializedGlobalWidget.Widget4 +>exporter.createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 >exporter : typeof exporter ->createExportedWidget4 : () => SpecializedGlobalWidget.Widget4 +>createExportedWidget4 : () => import("GlobalWidgets").SpecializedGlobalWidget.Widget4 } === tests/cases/compiler/privacyFunctionReturnTypeDeclFile_GlobalWidgets.ts === diff --git a/tests/baselines/reference/privacyImportParseErrors.types b/tests/baselines/reference/privacyImportParseErrors.types index 2f6c9e87dee..d647acf76db 100644 --- a/tests/baselines/reference/privacyImportParseErrors.types +++ b/tests/baselines/reference/privacyImportParseErrors.types @@ -1207,7 +1207,7 @@ module m2 { } export module m3 { ->m3 : typeof m3 +>m3 : typeof import("tests/cases/compiler/privacyImportParseErrors").m3 import m3 = require("use_glo_M1_public"); >m3 : any diff --git a/tests/baselines/reference/typeFromParamTagForFunction.types b/tests/baselines/reference/typeFromParamTagForFunction.types index a1f0dc230b5..476c6c3c453 100644 --- a/tests/baselines/reference/typeFromParamTagForFunction.types +++ b/tests/baselines/reference/typeFromParamTagForFunction.types @@ -86,17 +86,17 @@ export function C() { === tests/cases/conformance/salsa/c.js === const { C } = require("./c-ext"); ->C : typeof C +>C : typeof import("tests/cases/conformance/salsa/c-ext").C >require("./c-ext") : typeof import("tests/cases/conformance/salsa/c-ext") >require : (id: string) => any >"./c-ext" : "./c-ext" /** @param {C} p */ function c(p) { p.x; } ->c : (p: C) => void ->p : C +>c : (p: import("tests/cases/conformance/salsa/c-ext").C) => void +>p : import("tests/cases/conformance/salsa/c-ext").C >p.x : number ->p : C +>p : import("tests/cases/conformance/salsa/c-ext").C >x : number === tests/cases/conformance/salsa/d-ext.js === @@ -144,17 +144,17 @@ export class E { === tests/cases/conformance/salsa/e.js === const { E } = require("./e-ext"); ->E : typeof E +>E : typeof import("tests/cases/conformance/salsa/e-ext").E >require("./e-ext") : typeof import("tests/cases/conformance/salsa/e-ext") >require : (id: string) => any >"./e-ext" : "./e-ext" /** @param {E} p */ function e(p) { p.x; } ->e : (p: E) => void ->p : E +>e : (p: import("tests/cases/conformance/salsa/e-ext").E) => void +>p : import("tests/cases/conformance/salsa/e-ext").E >p.x : number ->p : E +>p : import("tests/cases/conformance/salsa/e-ext").E >x : number === tests/cases/conformance/salsa/f.js === diff --git a/tests/baselines/reference/umd-augmentation-2.types b/tests/baselines/reference/umd-augmentation-2.types index d84c4d4a020..6a2ba7eafcb 100644 --- a/tests/baselines/reference/umd-augmentation-2.types +++ b/tests/baselines/reference/umd-augmentation-2.types @@ -2,8 +2,8 @@ /// /// let v = new Math2d.Vector(3, 2); ->v : Vector ->new Math2d.Vector(3, 2) : Vector +>v : import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector +>new Math2d.Vector(3, 2) : import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector >Math2d.Vector : typeof Math2d.Vector >Math2d : typeof Math2d >Vector : typeof Math2d.Vector @@ -13,19 +13,19 @@ let v = new Math2d.Vector(3, 2); let magnitude = Math2d.getLength(v); >magnitude : number >Math2d.getLength(v) : number ->Math2d.getLength : (p: Vector) => number +>Math2d.getLength : (p: import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector) => number >Math2d : typeof Math2d ->getLength : (p: Vector) => number ->v : Vector +>getLength : (p: import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector) => number +>v : import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector let p: Math2d.Point = v.translate(5, 5); >p : Math2d.Point >Math2d : any >Point : Math2d.Point ->v.translate(5, 5) : Vector ->v.translate : (dx: number, dy: number) => Vector ->v : Vector ->translate : (dx: number, dy: number) => Vector +>v.translate(5, 5) : import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector +>v.translate : (dx: number, dy: number) => import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector +>v : import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector +>translate : (dx: number, dy: number) => import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector >5 : 5 >5 : 5 @@ -34,7 +34,7 @@ p = v.reverse(); >p : Math2d.Point >v.reverse() : Math2d.Point >v.reverse : () => Math2d.Point ->v : Vector +>v : import("tests/cases/conformance/externalModules/node_modules/math2d/index").Vector >reverse : () => Math2d.Point var t = p.x; diff --git a/tests/baselines/reference/varRequireFromJavascript.types b/tests/baselines/reference/varRequireFromJavascript.types index 7eee4ec188a..813c38898c5 100644 --- a/tests/baselines/reference/varRequireFromJavascript.types +++ b/tests/baselines/reference/varRequireFromJavascript.types @@ -7,16 +7,16 @@ var ex = require('./ex') // values work var crunch = new ex.Crunch(1); ->crunch : Crunch ->new ex.Crunch(1) : Crunch ->ex.Crunch : typeof Crunch +>crunch : import("tests/cases/conformance/salsa/ex").Crunch +>new ex.Crunch(1) : import("tests/cases/conformance/salsa/ex").Crunch +>ex.Crunch : typeof import("tests/cases/conformance/salsa/ex").Crunch >ex : typeof import("tests/cases/conformance/salsa/ex") ->Crunch : typeof Crunch +>Crunch : typeof import("tests/cases/conformance/salsa/ex").Crunch >1 : 1 crunch.n >crunch.n : number ->crunch : Crunch +>crunch : import("tests/cases/conformance/salsa/ex").Crunch >n : number @@ -25,12 +25,12 @@ crunch.n * @param {ex.Crunch} wrap */ function f(wrap) { ->f : (wrap: Crunch) => void ->wrap : Crunch +>f : (wrap: import("tests/cases/conformance/salsa/ex").Crunch) => void +>wrap : import("tests/cases/conformance/salsa/ex").Crunch wrap.n >wrap.n : number ->wrap : Crunch +>wrap : import("tests/cases/conformance/salsa/ex").Crunch >n : number } diff --git a/tests/baselines/reference/varRequireFromTypescript.types b/tests/baselines/reference/varRequireFromTypescript.types index 496b691d017..7010bfaf1a8 100644 --- a/tests/baselines/reference/varRequireFromTypescript.types +++ b/tests/baselines/reference/varRequireFromTypescript.types @@ -7,16 +7,16 @@ var ex = require('./ex') // values work var crunch = new ex.Crunch(1); ->crunch : Crunch ->new ex.Crunch(1) : Crunch ->ex.Crunch : typeof Crunch +>crunch : import("tests/cases/conformance/salsa/ex").Crunch +>new ex.Crunch(1) : import("tests/cases/conformance/salsa/ex").Crunch +>ex.Crunch : typeof import("tests/cases/conformance/salsa/ex").Crunch >ex : typeof import("tests/cases/conformance/salsa/ex") ->Crunch : typeof Crunch +>Crunch : typeof import("tests/cases/conformance/salsa/ex").Crunch >1 : 1 crunch.n >crunch.n : number ->crunch : Crunch +>crunch : import("tests/cases/conformance/salsa/ex").Crunch >n : number @@ -26,18 +26,18 @@ crunch.n * @param {ex.Crunch} wrap */ function f(greatest, wrap) { ->f : (greatest: { day: 1; }, wrap: Crunch) => void ->greatest : { day: 1; } ->wrap : Crunch +>f : (greatest: import("tests/cases/conformance/salsa/ex").Greatest, wrap: import("tests/cases/conformance/salsa/ex").Crunch) => void +>greatest : import("tests/cases/conformance/salsa/ex").Greatest +>wrap : import("tests/cases/conformance/salsa/ex").Crunch greatest.day >greatest.day : 1 ->greatest : { day: 1; } +>greatest : import("tests/cases/conformance/salsa/ex").Greatest >day : 1 wrap.n >wrap.n : number ->wrap : Crunch +>wrap : import("tests/cases/conformance/salsa/ex").Crunch >n : number } diff --git a/tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts b/tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts new file mode 100644 index 00000000000..4bfe03d5f53 --- /dev/null +++ b/tests/cases/compiler/declarationsForInferredTypeFromOtherFile.ts @@ -0,0 +1,12 @@ +// @declaration: true +// @filename: file1.ts +export class Foo {} +// @filename: file2.ts +export function foo(): import("./file1").Foo { + return null as any; +} +// @filename: file3.ts +import {foo} from "./file2"; +export function bar() { + return foo(); +} From c25b02fb5b7d22e57e09bb2d6327f1902aa0cd1c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 17 May 2018 14:07:49 -0700 Subject: [PATCH 18/30] Accept changed baseline (#24222) --- tests/baselines/reference/callbackCrossModule.types | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/baselines/reference/callbackCrossModule.types b/tests/baselines/reference/callbackCrossModule.types index d1d970c555e..2f7619585b9 100644 --- a/tests/baselines/reference/callbackCrossModule.types +++ b/tests/baselines/reference/callbackCrossModule.types @@ -24,8 +24,8 @@ function C() { === tests/cases/conformance/jsdoc/use.js === /** @param {import('./mod1').Con} k */ function f(k) { ->f : (k: (error: any) => any) => any ->k : (error: any) => any +>f : (k: import("tests/cases/conformance/jsdoc/mod1").Con) => any +>k : import("tests/cases/conformance/jsdoc/mod1").Con if (1 === 2 - 1) { >1 === 2 - 1 : boolean @@ -38,7 +38,7 @@ function f(k) { } return k({ ok: true}) >k({ ok: true}) : any ->k : (error: any) => any +>k : import("tests/cases/conformance/jsdoc/mod1").Con >{ ok: true} : { ok: boolean; } >ok : boolean >true : true From 08c364d258e78b4bf9151c1694a697c39988aa39 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 17 May 2018 14:08:58 -0700 Subject: [PATCH 19/30] fixUnusedIdentifier: Don't delete node whose ancestor was already deleted (#24207) --- src/services/codefixes/fixUnusedIdentifier.ts | 99 ++++++++++++------- src/services/suggestionDiagnostics.ts | 2 +- src/services/utilities.ts | 4 + ...edIdentifier_all_delete_paramInFunction.ts | 10 ++ 4 files changed, 79 insertions(+), 36 deletions(-) create mode 100644 tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_paramInFunction.ts diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index 5d7e019c28d..e15407b625b 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -19,7 +19,7 @@ namespace ts.codefix { const changes = textChanges.ChangeTracker.with(context, t => t.deleteNode(sourceFile, importDecl)); return [createCodeFixAction(fixName, changes, [Diagnostics.Remove_import_from_0, showModuleSpecifier(importDecl)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)]; } - const delDestructure = textChanges.ChangeTracker.with(context, t => tryDeleteFullDestructure(t, sourceFile, context.span.start)); + const delDestructure = textChanges.ChangeTracker.with(context, t => tryDeleteFullDestructure(t, sourceFile, context.span.start, /*deleted*/ undefined)); if (delDestructure.length) { return [createCodeFixAction(fixName, delDestructure, Diagnostics.Remove_destructuring, fixIdDelete, Diagnostics.Delete_all_unused_declarations)]; } @@ -27,7 +27,7 @@ namespace ts.codefix { const token = getToken(sourceFile, textSpanEnd(context.span)); const result: CodeFixAction[] = []; - const deletion = textChanges.ChangeTracker.with(context, t => tryDeleteDeclaration(t, sourceFile, token)); + const deletion = textChanges.ChangeTracker.with(context, t => tryDeleteDeclaration(t, sourceFile, token, /*deleted*/ undefined)); if (deletion.length) { result.push(createCodeFixAction(fixName, deletion, [Diagnostics.Remove_declaration_for_Colon_0, token.getText(sourceFile)], fixIdDelete, Diagnostics.Delete_all_unused_declarations)); } @@ -40,30 +40,37 @@ namespace ts.codefix { return result; }, fixIds: [fixIdPrefix, fixIdDelete], - getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { - const { sourceFile } = context; - const token = findPrecedingToken(textSpanEnd(diag), diag.file!); - switch (context.fixId) { - case fixIdPrefix: - if (isIdentifier(token) && canPrefix(token)) { - tryPrefixDeclaration(changes, diag.code, sourceFile, token); - } - break; - case fixIdDelete: - const importDecl = tryGetFullImport(diag.file!, diag.start!); - if (importDecl) { - changes.deleteNode(sourceFile, importDecl); - } - else { - if (!tryDeleteFullDestructure(changes, sourceFile, diag.start!)) { - tryDeleteDeclaration(changes, sourceFile, token); + getAllCodeActions: context => { + // Track a set of deleted nodes that may be ancestors of other marked for deletion -- only delete the ancestors. + const deleted = new NodeSet(); + return codeFixAll(context, errorCodes, (changes, diag) => { + const { sourceFile } = context; + const token = findPrecedingToken(textSpanEnd(diag), diag.file!); + switch (context.fixId) { + case fixIdPrefix: + if (isIdentifier(token) && canPrefix(token)) { + tryPrefixDeclaration(changes, diag.code, sourceFile, token); } - } - break; - default: - Debug.fail(JSON.stringify(context.fixId)); - } - }), + break; + case fixIdDelete: + // Ignore if this range was already deleted. + if (deleted.some(d => rangeContainsPosition(d, diag.start!))) break; + + const importDecl = tryGetFullImport(diag.file!, diag.start!); + if (importDecl) { + changes.deleteNode(sourceFile, importDecl); + } + else { + if (!tryDeleteFullDestructure(changes, sourceFile, diag.start!, deleted)) { + tryDeleteDeclaration(changes, sourceFile, token, deleted); + } + } + break; + default: + Debug.fail(JSON.stringify(context.fixId)); + } + }); + }, }); // Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. @@ -72,18 +79,20 @@ namespace ts.codefix { return startToken.kind === SyntaxKind.ImportKeyword ? tryCast(startToken.parent, isImportDeclaration) : undefined; } - function tryDeleteFullDestructure(changes: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number): boolean { + function tryDeleteFullDestructure(changes: textChanges.ChangeTracker, sourceFile: SourceFile, pos: number, deletedAncestors: NodeSet | undefined): boolean { const startToken = getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false); if (startToken.kind !== SyntaxKind.OpenBraceToken || !isObjectBindingPattern(startToken.parent)) return false; const decl = startToken.parent.parent; switch (decl.kind) { case SyntaxKind.VariableDeclaration: - tryDeleteVariableDeclaration(changes, sourceFile, decl); + tryDeleteVariableDeclaration(changes, sourceFile, decl, deletedAncestors); break; case SyntaxKind.Parameter: + if (deletedAncestors) deletedAncestors.add(decl); changes.deleteNodeInList(sourceFile, decl); break; case SyntaxKind.BindingElement: + if (deletedAncestors) deletedAncestors.add(decl); changes.deleteNode(sourceFile, decl); break; default: @@ -121,34 +130,37 @@ namespace ts.codefix { return false; } - function tryDeleteDeclaration(changes: textChanges.ChangeTracker, sourceFile: SourceFile, token: Node): void { + function tryDeleteDeclaration(changes: textChanges.ChangeTracker, sourceFile: SourceFile, token: Node, deletedAncestors: NodeSet | undefined): void { switch (token.kind) { case SyntaxKind.Identifier: - tryDeleteIdentifier(changes, sourceFile, token); + tryDeleteIdentifier(changes, sourceFile, token, deletedAncestors); break; case SyntaxKind.PropertyDeclaration: case SyntaxKind.NamespaceImport: + if (deletedAncestors) deletedAncestors.add(token.parent); changes.deleteNode(sourceFile, token.parent); break; default: - tryDeleteDefault(changes, sourceFile, token); + tryDeleteDefault(changes, sourceFile, token, deletedAncestors); } } - function tryDeleteDefault(changes: textChanges.ChangeTracker, sourceFile: SourceFile, token: Node): void { + function tryDeleteDefault(changes: textChanges.ChangeTracker, sourceFile: SourceFile, token: Node, deletedAncestors: NodeSet | undefined): void { if (isDeclarationName(token)) { + if (deletedAncestors) deletedAncestors.add(token.parent); changes.deleteNode(sourceFile, token.parent); } else if (isLiteralComputedPropertyDeclarationName(token)) { + if (deletedAncestors) deletedAncestors.add(token.parent.parent); changes.deleteNode(sourceFile, token.parent.parent); } } - function tryDeleteIdentifier(changes: textChanges.ChangeTracker, sourceFile: SourceFile, identifier: Identifier): void { + function tryDeleteIdentifier(changes: textChanges.ChangeTracker, sourceFile: SourceFile, identifier: Identifier, deletedAncestors: NodeSet | undefined): void { const parent = identifier.parent; switch (parent.kind) { case SyntaxKind.VariableDeclaration: - tryDeleteVariableDeclaration(changes, sourceFile, parent); + tryDeleteVariableDeclaration(changes, sourceFile, parent, deletedAncestors); break; case SyntaxKind.TypeParameter: @@ -255,7 +267,7 @@ namespace ts.codefix { break; default: - tryDeleteDefault(changes, sourceFile, identifier); + tryDeleteDefault(changes, sourceFile, identifier, deletedAncestors); break; } } @@ -280,15 +292,17 @@ namespace ts.codefix { } // token.parent is a variableDeclaration - function tryDeleteVariableDeclaration(changes: textChanges.ChangeTracker, sourceFile: SourceFile, varDecl: VariableDeclaration): void { + function tryDeleteVariableDeclaration(changes: textChanges.ChangeTracker, sourceFile: SourceFile, varDecl: VariableDeclaration, deletedAncestors: NodeSet | undefined): void { switch (varDecl.parent.parent.kind) { case SyntaxKind.ForStatement: { const forStatement = varDecl.parent.parent; const forInitializer = forStatement.initializer; if (forInitializer.declarations.length === 1) { + if (deletedAncestors) deletedAncestors.add(forInitializer); changes.deleteNode(sourceFile, forInitializer); } else { + if (deletedAncestors) deletedAncestors.add(varDecl); changes.deleteNodeInList(sourceFile, varDecl); } break; @@ -298,6 +312,7 @@ namespace ts.codefix { const forOfStatement = varDecl.parent.parent; Debug.assert(forOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList); const forOfInitializer = forOfStatement.initializer; + if (deletedAncestors) deletedAncestors.add(forOfInitializer.declarations[0]); changes.replaceNode(sourceFile, forOfInitializer.declarations[0], createObjectLiteral()); break; @@ -308,11 +323,25 @@ namespace ts.codefix { default: const variableStatement = varDecl.parent.parent; if (variableStatement.declarationList.declarations.length === 1) { + if (deletedAncestors) deletedAncestors.add(variableStatement); changes.deleteNode(sourceFile, variableStatement); } else { + if (deletedAncestors) deletedAncestors.add(varDecl); changes.deleteNodeInList(sourceFile, varDecl); } } } + + class NodeSet { + private map = createMap(); + + add(node: Node): void { + this.map.set(String(getNodeId(node)), node); + } + + some(pred: (node: Node) => boolean): boolean { + return forEachEntry(this.map, pred) || false; + } + } } diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index f2961e19345..3135fdc368b 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -60,7 +60,7 @@ namespace ts { } } - return diags.concat(checker.getSuggestionDiagnostics(sourceFile)); + return diags.concat(checker.getSuggestionDiagnostics(sourceFile)).sort((d1, d2) => d1.start - d2.start); } // convertToEs6Module only works on top-level, so don't trigger it if commonjs code only appears in nested scopes. diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 399b7184e62..fc5637f3280 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -417,6 +417,10 @@ namespace ts { return startEndContainsRange(r1.pos, r1.end, r2); } + export function rangeContainsPosition(r: TextRange, pos: number): boolean { + return r.pos <= pos && pos <= r.end; + } + export function startEndContainsRange(start: number, end: number, range: TextRange): boolean { return start <= range.pos && end >= range.end; } diff --git a/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_paramInFunction.ts b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_paramInFunction.ts new file mode 100644 index 00000000000..80b190700bf --- /dev/null +++ b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete_paramInFunction.ts @@ -0,0 +1,10 @@ +/// + +////export {}; +////function f(x) {} + +verify.codeFixAll({ + fixId: "unusedIdentifier_delete", + fixAllDescription: "Delete all unused declarations", + newFileContent: "export {};\n", +}); From 3800d7b2468aa8a29940b720575c5fc9acee2bee Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 17 May 2018 14:30:07 -0700 Subject: [PATCH 20/30] More robust circularity detection in node builder (#24225) --- src/compiler/checker.ts | 29 +++++++-------- ...lassExpressionInClassStaticDeclarations.js | 37 +++++++++++++++++++ ...xpressionInClassStaticDeclarations.symbols | 8 ++++ ...sExpressionInClassStaticDeclarations.types | 9 +++++ ...lassExpressionInClassStaticDeclarations.ts | 4 ++ 5 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 tests/baselines/reference/classExpressionInClassStaticDeclarations.js create mode 100644 tests/baselines/reference/classExpressionInClassStaticDeclarations.symbols create mode 100644 tests/baselines/reference/classExpressionInClassStaticDeclarations.types create mode 100644 tests/cases/compiler/classExpressionInClassStaticDeclarations.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b7da56501ac..3e3c3964b94 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3060,7 +3060,7 @@ namespace ts { flags, tracker: tracker && tracker.trackSymbol ? tracker : { trackSymbol: noop }, encounteredError: false, - symbolStack: undefined, + visitedSymbols: undefined, inferTypeParameters: undefined }; } @@ -3242,7 +3242,10 @@ namespace ts { function createAnonymousTypeNode(type: ObjectType): TypeNode { const symbol = type.symbol; + let id: string; if (symbol) { + const isConstructorObject = getObjectFlags(type) & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & SymbolFlags.Class; + id = (isConstructorObject ? "+" : "") + getSymbolId(symbol); if (isJavaScriptConstructor(symbol.valueDeclaration)) { // Instance and static types share the same symbol; only add 'typeof' for the static side. const isInstanceType = type === getInferredClassType(symbol) ? SymbolFlags.Type : SymbolFlags.Value; @@ -3254,7 +3257,7 @@ namespace ts { shouldWriteTypeOfFunctionSymbol()) { return symbolToTypeNode(symbol, context, SymbolFlags.Value); } - else if (contains(context.symbolStack, symbol)) { + else if (context.visitedSymbols && context.visitedSymbols.has(id)) { // If type is an anonymous type literal in a type alias declaration, use type alias name const typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { @@ -3268,20 +3271,14 @@ namespace ts { else { // Since instantiations of the same anonymous type have the same symbol, tracking symbols instead // of types allows us to catch circular references to instantiations of the same anonymous type - if (!context.symbolStack) { - context.symbolStack = []; + if (!context.visitedSymbols) { + context.visitedSymbols = createMap(); } - const isConstructorObject = getObjectFlags(type) & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & SymbolFlags.Class; - if (isConstructorObject) { - return createTypeNodeFromObjectType(type); - } - else { - context.symbolStack.push(symbol); - const result = createTypeNodeFromObjectType(type); - context.symbolStack.pop(); - return result; - } + context.visitedSymbols.set(id, true); + const result = createTypeNodeFromObjectType(type); + context.visitedSymbols.delete(id); + return result; } } else { @@ -3298,7 +3295,7 @@ namespace ts { declaration.parent.kind === SyntaxKind.SourceFile || declaration.parent.kind === SyntaxKind.ModuleBlock)); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions - return (!!(context.flags & NodeBuilderFlags.UseTypeOfFunction) || contains(context.symbolStack, symbol)) && // it is type of the symbol uses itself recursively + return (!!(context.flags & NodeBuilderFlags.UseTypeOfFunction) || (context.visitedSymbols && context.visitedSymbols.has(id))) && // it is type of the symbol uses itself recursively (!(context.flags & NodeBuilderFlags.UseStructuralFallback) || isValueSymbolAccessible(symbol, context.enclosingDeclaration)); // And the build is going to succeed without visibility error or there is no structural fallback allowed } } @@ -3997,7 +3994,7 @@ namespace ts { // State encounteredError: boolean; - symbolStack: Symbol[] | undefined; + visitedSymbols: Map | undefined; inferTypeParameters: TypeParameter[] | undefined; } diff --git a/tests/baselines/reference/classExpressionInClassStaticDeclarations.js b/tests/baselines/reference/classExpressionInClassStaticDeclarations.js new file mode 100644 index 00000000000..9fbaeef12b0 --- /dev/null +++ b/tests/baselines/reference/classExpressionInClassStaticDeclarations.js @@ -0,0 +1,37 @@ +//// [classExpressionInClassStaticDeclarations.ts] +class C { + static D = class extends C {}; +} + +//// [classExpressionInClassStaticDeclarations.js] +var __extends = (this && this.__extends) || (function () { + var 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 function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var C = /** @class */ (function () { + function C() { + } + C.D = /** @class */ (function (_super) { + __extends(class_1, _super); + function class_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + return class_1; + }(C)); + return C; +}()); + + +//// [classExpressionInClassStaticDeclarations.d.ts] +declare class C { + static D: { + new (): {}; + D: any; + }; +} diff --git a/tests/baselines/reference/classExpressionInClassStaticDeclarations.symbols b/tests/baselines/reference/classExpressionInClassStaticDeclarations.symbols new file mode 100644 index 00000000000..99ca22158d6 --- /dev/null +++ b/tests/baselines/reference/classExpressionInClassStaticDeclarations.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/classExpressionInClassStaticDeclarations.ts === +class C { +>C : Symbol(C, Decl(classExpressionInClassStaticDeclarations.ts, 0, 0)) + + static D = class extends C {}; +>D : Symbol(C.D, Decl(classExpressionInClassStaticDeclarations.ts, 0, 9)) +>C : Symbol(C, Decl(classExpressionInClassStaticDeclarations.ts, 0, 0)) +} diff --git a/tests/baselines/reference/classExpressionInClassStaticDeclarations.types b/tests/baselines/reference/classExpressionInClassStaticDeclarations.types new file mode 100644 index 00000000000..da701149b1d --- /dev/null +++ b/tests/baselines/reference/classExpressionInClassStaticDeclarations.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/classExpressionInClassStaticDeclarations.ts === +class C { +>C : C + + static D = class extends C {}; +>D : typeof (Anonymous class) +>class extends C {} : typeof (Anonymous class) +>C : C +} diff --git a/tests/cases/compiler/classExpressionInClassStaticDeclarations.ts b/tests/cases/compiler/classExpressionInClassStaticDeclarations.ts new file mode 100644 index 00000000000..2e442d0af0d --- /dev/null +++ b/tests/cases/compiler/classExpressionInClassStaticDeclarations.ts @@ -0,0 +1,4 @@ +// @declaration: true +class C { + static D = class extends C {}; +} \ No newline at end of file From 75ab60f199641e47ba31105a181606501040fdbe Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 17 May 2018 14:31:58 -0700 Subject: [PATCH 21/30] Improve ChangeTracker#deleteNodeInList (#24221) --- src/compiler/core.ts | 9 +++ src/services/textChanges.ts | 59 +++++++++---------- src/services/utilities.ts | 17 ++++++ .../codeFixUnusedIdentifier_all_delete.ts | 4 +- .../incompleteFunctionCallCodefix2.ts | 1 + 5 files changed, 59 insertions(+), 31 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index fb4324eb0a4..41e754a689e 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -320,6 +320,15 @@ namespace ts { return -1; } + export function findLastIndex(array: ReadonlyArray, predicate: (element: T, index: number) => boolean, startIndex?: number): number { + for (let i = startIndex === undefined ? array.length - 1 : startIndex; i >= 0; i--) { + if (predicate(array[i], i)) { + return i; + } + } + return -1; + } + /** * Returns the first truthy result of `callback`, or else fails. * This is like `forEach`, but never returns undefined. diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 3994259a640..6002b79d2c4 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -212,7 +212,7 @@ namespace ts.textChanges { export class ChangeTracker { private readonly changes: Change[] = []; private readonly newFiles: { readonly oldFile: SourceFile, readonly fileName: string, readonly statements: ReadonlyArray }[] = []; - private readonly deletedNodesInLists: true[] = []; // Stores ids of nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`. + private readonly deletedNodesInLists = new NodeSet(); // Stores ids of nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`. private readonly classesWithNodesInsertedAtStart = createMap(); // Set implemented as Map public static fromContext(context: TextChangesContext): ChangeTracker { @@ -262,35 +262,15 @@ namespace ts.textChanges { this.deleteNode(sourceFile, node); return this; } - const id = getNodeId(node); - Debug.assert(!this.deletedNodesInLists[id], "Deleting a node twice"); - this.deletedNodesInLists[id] = true; - if (index !== containingList.length - 1) { - const nextToken = getTokenAtPosition(sourceFile, node.end, /*includeJsDocComment*/ false); - if (nextToken && isSeparator(node, nextToken)) { - // find first non-whitespace position in the leading trivia of the node - const startPosition = skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); - const nextElement = containingList[index + 1]; - /// find first non-whitespace position in the leading trivia of the next node - const endPosition = skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, nextElement, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); - // shift next node so its first non-whitespace position will be moved to the first non-whitespace position of the deleted node - this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); - } - } - else { - const prev = containingList[index - 1]; - if (this.deletedNodesInLists[getNodeId(prev)]) { - const pos = skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); - const end = getAdjustedEndPosition(sourceFile, node, {}); - this.deleteRange(sourceFile, { pos, end }); - } - else { - const previousToken = getTokenAtPosition(sourceFile, containingList[index - 1].end, /*includeJsDocComment*/ false); - if (previousToken && isSeparator(node, previousToken)) { - this.deleteNodeRange(sourceFile, previousToken, node); - } - } - } + + // Note: We will only delete a comma *after* a node. This will leave a trailing comma if we delete the last node. + // That's handled in the end by `finishTrailingCommaAfterDeletingNodesInList`. + Debug.assert(!this.deletedNodesInLists.has(node), "Deleting a node twice"); + this.deletedNodesInLists.add(node); + this.deleteRange(sourceFile, { + pos: startPositionToDeleteNodeInList(sourceFile, node), + end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]), + }); return this; } @@ -683,6 +663,19 @@ namespace ts.textChanges { }); } + private finishTrailingCommaAfterDeletingNodesInList() { + this.deletedNodesInLists.forEach(node => { + const sourceFile = node.getSourceFile(); + const list = formatting.SmartIndenter.getContainingList(node, sourceFile); + if (node !== last(list)) return; + + const lastNonDeletedIndex = findLastIndex(list, n => !this.deletedNodesInLists.has(n), list.length - 2); + if (lastNonDeletedIndex !== -1) { + this.deleteRange(sourceFile, { pos: list[lastNonDeletedIndex].end, end: startPositionToDeleteNodeInList(sourceFile, list[lastNonDeletedIndex + 1]) }); + } + }); + } + /** * Note: after calling this, the TextChanges object must be discarded! * @param validate only for tests @@ -691,6 +684,7 @@ namespace ts.textChanges { */ public getChanges(validate?: ValidateNonFormattedText): FileTextChanges[] { this.finishClassesWithNodesInsertedAtStart(); + this.finishTrailingCommaAfterDeletingNodesInList(); const changes = changesToText.getTextChangesFromChanges(this.changes, this.newLineCharacter, this.formatContext, validate); for (const { oldFile, fileName, statements } of this.newFiles) { changes.push(changesToText.newFileChanges(oldFile, fileName, statements, this.newLineCharacter)); @@ -703,6 +697,11 @@ namespace ts.textChanges { } } + // find first non-whitespace position in the leading trivia of the node + function startPositionToDeleteNodeInList(sourceFile: SourceFile, node: Node): number { + return skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); + } + function getClassBraceEnds(cls: ClassLikeDeclaration, sourceFile: SourceFile): [number, number] { return [findChildOfKind(cls, SyntaxKind.OpenBraceToken, sourceFile).end, findChildOfKind(cls, SyntaxKind.CloseBraceToken, sourceFile).end]; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index fc5637f3280..b389b956eac 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1280,6 +1280,23 @@ namespace ts { } return propSymbol; } + + export class NodeSet { + private map = createMap(); + + add(node: Node): void { + this.map.set(String(getNodeId(node)), node); + } + has(node: Node): boolean { + return this.map.has(String(getNodeId(node))); + } + forEach(cb: (node: Node) => void): void { + this.map.forEach(cb); + } + some(pred: (node: Node) => boolean): boolean { + return forEachEntry(this.map, pred) || false; + } + } } // Display-part writer helpers diff --git a/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts index 8b7234732e2..67f75a894da 100644 --- a/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts +++ b/tests/cases/fourslash/codeFixUnusedIdentifier_all_delete.ts @@ -6,11 +6,13 @@ ////function f(a, b) { //// const x = 0; ////} +////function g(a, b, c) { return a; } verify.codeFixAll({ fixId: "unusedIdentifier_delete", fixAllDescription: "Delete all unused declarations", newFileContent: `function f() { -}`, +} +function g(a) { return a; }`, }); diff --git a/tests/cases/fourslash/incompleteFunctionCallCodefix2.ts b/tests/cases/fourslash/incompleteFunctionCallCodefix2.ts index 0fd17758500..cc4ae7b8364 100644 --- a/tests/cases/fourslash/incompleteFunctionCallCodefix2.ts +++ b/tests/cases/fourslash/incompleteFunctionCallCodefix2.ts @@ -5,5 +5,6 @@ verify.codeFix({ description: "Prefix 'C' with an underscore", + index: 1, newFileContent: "function f(new _C(100, 3, undefined)", }); From d579793d0aba0b531fd0edc8fa3e5e3df2bd4140 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 17 May 2018 14:32:12 -0700 Subject: [PATCH 22/30] moveToNewFile: Fix bug for missing importClause (#24224) --- src/services/refactors/moveToNewFile.ts | 1 + tests/cases/fourslash/moveToNewFile.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 3ec64171b17..d0d0df4250e 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -440,6 +440,7 @@ namespace ts.refactor { switch (i.kind) { case SyntaxKind.ImportDeclaration: { const clause = i.importClause; + if (!clause) return undefined; const defaultImport = clause.name && keep(clause.name) ? clause.name : undefined; const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); return defaultImport || namedBindings diff --git a/tests/cases/fourslash/moveToNewFile.ts b/tests/cases/fourslash/moveToNewFile.ts index cd2bd4ff8d6..a4d243e4a03 100644 --- a/tests/cases/fourslash/moveToNewFile.ts +++ b/tests/cases/fourslash/moveToNewFile.ts @@ -1,6 +1,7 @@ /// // @Filename: /a.ts +////import "./foo"; ////import { a, b, alreadyUnused } from "./other"; ////const p = 0; ////[|const y = p + b;|] @@ -11,6 +12,7 @@ verify.moveToNewFile({ "/a.ts": `import { y } from "./y"; +import "./foo"; import { a, alreadyUnused } from "./other"; export const p = 0; a; y;`, From d82d35c7f5eb906754e7160509dadb119a543077 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 17 May 2018 15:16:18 -0700 Subject: [PATCH 23/30] Set startPos at EOF in jsdoc token scanner so node end positions for nodes terminated at EoF are right (#24184) * Set startPos at EOF in jsdoc token scanner to node end positions for nodes terminated at EoF are right * More complete nonwhitespace token check, fix syntactica jsdoc classifier * Use loop and no nested lookahead * Do thigns unrelated to the bug in the test * Fix typo move return * Patch up typedef end pos * Fix indentation, make end pos target more obvious --- src/compiler/parser.ts | 25 ++++++++++++-- src/compiler/scanner.ts | 4 +-- src/services/classifier.ts | 5 +-- ...ts.parsesCorrectly.Nested @param tags.json | 8 ++--- ...parsesCorrectly.argSynonymForParamTag.json | 4 +-- ...sCorrectly.argumentSynonymForParamTag.json | 4 +-- ...less-than and greater-than characters.json | 4 +-- ...Comments.parsesCorrectly.noReturnType.json | 4 +-- ...cComments.parsesCorrectly.oneParamTag.json | 4 +-- ...DocComments.parsesCorrectly.paramTag1.json | 4 +-- ...arsesCorrectly.paramTagBracketedName1.json | 4 +-- ...arsesCorrectly.paramTagBracketedName2.json | 4 +-- ...parsesCorrectly.paramTagNameThenType2.json | 4 +-- ...ents.parsesCorrectly.paramWithoutType.json | 4 +-- ...cComments.parsesCorrectly.templateTag.json | 8 ++--- ...Comments.parsesCorrectly.templateTag2.json | 8 ++--- ...Comments.parsesCorrectly.templateTag3.json | 8 ++--- ...Comments.parsesCorrectly.templateTag4.json | 8 ++--- ...Comments.parsesCorrectly.templateTag5.json | 8 ++--- ...Comments.parsesCorrectly.twoParamTag2.json | 4 +-- ...parsesCorrectly.twoParamTagOnSameLine.json | 4 +-- ...sCorrectly.typedefTagWithChildrenTags.json | 8 ++--- .../incrementalJsDocAdjustsLengthsRight.ts | 33 +++++++++++++++++++ 23 files changed, 112 insertions(+), 59 deletions(-) create mode 100644 tests/cases/fourslash/incrementalJsDocAdjustsLengthsRight.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0b9a0142496..3a7adbc2609 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6481,7 +6481,25 @@ namespace ts { return finishNode(result, end); } + function isNextNonwhitespaceTokenEndOfFile(): boolean { + // We must use infinite lookahead, as there could be any number of newlines :( + while (true) { + nextJSDocToken(); + if (token() === SyntaxKind.EndOfFileToken) { + return true; + } + if (!(token() === SyntaxKind.WhitespaceTrivia || token() === SyntaxKind.NewLineTrivia)) { + return false; + } + } + } + function skipWhitespace(): void { + if (token() === SyntaxKind.WhitespaceTrivia || token() === SyntaxKind.NewLineTrivia) { + if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) { + return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range + } + } while (token() === SyntaxKind.WhitespaceTrivia || token() === SyntaxKind.NewLineTrivia) { nextJSDocToken(); } @@ -6802,6 +6820,7 @@ namespace ts { typedefTag.comment = parseTagComments(indent); typedefTag.typeExpression = typeExpression; + let end: number; if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) { let child: JSDocTypeTag | JSDocPropertyTag | false; let jsdocTypeLiteral: JSDocTypeLiteral; @@ -6830,10 +6849,12 @@ namespace ts { typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : finishNode(jsdocTypeLiteral); + end = typedefTag.typeExpression.end; } } - return finishNode(typedefTag); + // Only include the characters between the name end and the next token if a comment was actually parsed out - otherwise it's just whitespace + return finishNode(typedefTag, end || typedefTag.comment !== undefined ? scanner.getStartPos() : (typedefTag.fullName || typedefTag.typeExpression || typedefTag.tagName).end); } function parseJSDocTypeNameWithNamespace(nested?: boolean) { @@ -7075,7 +7096,7 @@ namespace ts { const pos = scanner.getTokenPos(); const end = scanner.getTextPos(); const result = createNode(SyntaxKind.Identifier, pos); - result.escapedText = escapeLeadingUnderscores(content.substring(pos, end)); + result.escapedText = escapeLeadingUnderscores(scanner.getTokenText()); finishNode(result, end); nextJSDocToken(); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index f2a01d22c24..1f0c097d22a 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1928,13 +1928,11 @@ namespace ts { } function scanJSDocToken(): JsDocSyntaxKind { + startPos = tokenPos = pos; if (pos >= end) { return token = SyntaxKind.EndOfFileToken; } - startPos = pos; - tokenPos = pos; - const ch = text.charCodeAt(pos); pos++; switch (ch) { diff --git a/src/services/classifier.ts b/src/services/classifier.ts index 89c96a45021..9719a1ccdad 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -706,16 +706,17 @@ namespace ts { break; case SyntaxKind.JSDocTemplateTag: processJSDocTemplateTag(tag); + pos = tag.end; break; case SyntaxKind.JSDocTypeTag: processElement((tag).typeExpression); + pos = tag.end; break; case SyntaxKind.JSDocReturnTag: processElement((tag).typeExpression); + pos = tag.end; break; } - - pos = tag.end; } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 03cffdc49ff..73d3f598059 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 6, - "end": 63, + "end": 64, "atToken": { "kind": "AtToken", "pos": 6, @@ -21,11 +21,11 @@ "typeExpression": { "kind": "JSDocTypeExpression", "pos": 34, - "end": 63, + "end": 64, "type": { "kind": "JSDocTypeLiteral", "pos": 34, - "end": 63, + "end": 64, "jsDocPropertyTags": [ { "kind": "JSDocParameterTag", @@ -88,6 +88,6 @@ }, "length": 1, "pos": 6, - "end": 63 + "end": 64 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index 00d7f0dcc30..cde6addda7c 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 40, + "end": 42, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 40 + "end": 42 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index 6953601f112..f193bc3fe9e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 45, + "end": 47, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 45 + "end": 47 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 472fbbeb6bb..37d4610f987 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 7, - "end": 58, + "end": 59, "atToken": { "kind": "AtToken", "pos": 7, @@ -30,6 +30,6 @@ }, "length": 1, "pos": 7, - "end": 58 + "end": 59 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json index 079d09c6eeb..204ba39d3dd 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocReturnTag", "pos": 8, - "end": 16, + "end": 15, "atToken": { "kind": "AtToken", "pos": 8, @@ -21,6 +21,6 @@ }, "length": 1, "pos": 8, - "end": 16 + "end": 15 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json index 4940bcf325e..f5eee243cf5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 30, + "end": 32, "atToken": { "kind": "AtToken", "pos": 8, @@ -39,6 +39,6 @@ }, "length": 1, "pos": 8, - "end": 30 + "end": 32 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index b3e58d84923..cbbb64b5a73 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 55, + "end": 57, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 55 + "end": 57 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 6721afb2ea7..a27e0d158e2 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 57, + "end": 59, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 57 + "end": 59 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index bf53423ad6a..d271a3b3483 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 62, + "end": 64, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 62 + "end": 64 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index 68edeb90190..57ab44a68b7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 42, + "end": 44, "atToken": { "kind": "AtToken", "pos": 8, @@ -40,6 +40,6 @@ }, "length": 1, "pos": 8, - "end": 42 + "end": 44 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json index 3d511525c64..e85d787cd99 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocParameterTag", "pos": 8, - "end": 19, + "end": 21, "atToken": { "kind": "AtToken", "pos": 8, @@ -29,6 +29,6 @@ }, "length": 1, "pos": 8, - "end": 19 + "end": 21 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json index 8a146e3cfaf..4d16157d91d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 20, + "end": 19, "atToken": { "kind": "AtToken", "pos": 8, @@ -22,7 +22,7 @@ "0": { "kind": "TypeParameter", "pos": 18, - "end": 20, + "end": 19, "name": { "kind": "Identifier", "pos": 18, @@ -32,11 +32,11 @@ }, "length": 1, "pos": 18, - "end": 20 + "end": 19 } }, "length": 1, "pos": 8, - "end": 20 + "end": 19 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json index 5bb1df30665..3f5f2a54ec7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 22, + "end": 21, "atToken": { "kind": "AtToken", "pos": 8, @@ -33,7 +33,7 @@ "1": { "kind": "TypeParameter", "pos": 20, - "end": 22, + "end": 21, "name": { "kind": "Identifier", "pos": 20, @@ -43,11 +43,11 @@ }, "length": 2, "pos": 18, - "end": 22 + "end": 21 } }, "length": 1, "pos": 8, - "end": 22 + "end": 21 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json index 295b2122daa..ab1b9db8782 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 23, + "end": 22, "atToken": { "kind": "AtToken", "pos": 8, @@ -33,7 +33,7 @@ "1": { "kind": "TypeParameter", "pos": 21, - "end": 23, + "end": 22, "name": { "kind": "Identifier", "pos": 21, @@ -43,11 +43,11 @@ }, "length": 2, "pos": 18, - "end": 23 + "end": 22 } }, "length": 1, "pos": 8, - "end": 23 + "end": 22 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json index 4aa29db3092..193c5c0eb01 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 23, + "end": 22, "atToken": { "kind": "AtToken", "pos": 8, @@ -33,7 +33,7 @@ "1": { "kind": "TypeParameter", "pos": 21, - "end": 23, + "end": 22, "name": { "kind": "Identifier", "pos": 21, @@ -43,11 +43,11 @@ }, "length": 2, "pos": 18, - "end": 23 + "end": 22 } }, "length": 1, "pos": 8, - "end": 23 + "end": 22 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json index 5e707f6f03b..80e127b0759 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocTemplateTag", "pos": 8, - "end": 24, + "end": 23, "atToken": { "kind": "AtToken", "pos": 8, @@ -33,7 +33,7 @@ "1": { "kind": "TypeParameter", "pos": 22, - "end": 24, + "end": 23, "name": { "kind": "Identifier", "pos": 22, @@ -43,11 +43,11 @@ }, "length": 2, "pos": 18, - "end": 24 + "end": 23 } }, "length": 1, "pos": 8, - "end": 24 + "end": 23 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json index 6f073802fcd..3a5e71ef8b1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json @@ -40,7 +40,7 @@ "1": { "kind": "JSDocParameterTag", "pos": 34, - "end": 56, + "end": 58, "atToken": { "kind": "AtToken", "pos": 34, @@ -73,6 +73,6 @@ }, "length": 2, "pos": 8, - "end": 56 + "end": 58 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json index e1ef0adb926..51868df260b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json @@ -40,7 +40,7 @@ "1": { "kind": "JSDocParameterTag", "pos": 30, - "end": 52, + "end": 54, "atToken": { "kind": "AtToken", "pos": 30, @@ -73,6 +73,6 @@ }, "length": 2, "pos": 8, - "end": 52 + "end": 54 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json index 98a59931ad8..cf523b71c99 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json @@ -6,7 +6,7 @@ "0": { "kind": "JSDocTypedefTag", "pos": 8, - "end": 98, + "end": 100, "atToken": { "kind": "AtToken", "pos": 8, @@ -33,7 +33,7 @@ "typeExpression": { "kind": "JSDocTypeLiteral", "pos": 28, - "end": 98, + "end": 100, "jsDocPropertyTags": [ { "kind": "JSDocPropertyTag", @@ -72,7 +72,7 @@ { "kind": "JSDocPropertyTag", "pos": 74, - "end": 98, + "end": 97, "atToken": { "kind": "AtToken", "pos": 74, @@ -108,6 +108,6 @@ }, "length": 1, "pos": 8, - "end": 98 + "end": 100 } } \ No newline at end of file diff --git a/tests/cases/fourslash/incrementalJsDocAdjustsLengthsRight.ts b/tests/cases/fourslash/incrementalJsDocAdjustsLengthsRight.ts new file mode 100644 index 00000000000..626a1e37258 --- /dev/null +++ b/tests/cases/fourslash/incrementalJsDocAdjustsLengthsRight.ts @@ -0,0 +1,33 @@ +/// + +// @noLib: true +//// +/////** +//// * Pad `str` to `width`. +//// * +//// * @param {String} str +//// * @param {Number} wid/*1*/ +goTo.marker('1'); +edit.insert("th\n@"); +const c = classification; +verify.syntacticClassificationsAre( + c.comment("/**\n * Pad `str` to `width`.\n *\n * "), + c.punctuation("@"), + c.docCommentTagName("param"), + c.comment(" "), + c.punctuation("{"), + c.identifier("String"), + c.punctuation("}"), + c.comment(" "), + c.parameterName("str"), + c.comment("\n * "), + c.punctuation("@"), + c.docCommentTagName("param"), + c.comment(" "), + c.punctuation("{"), + c.identifier("Number"), + c.punctuation("}"), + c.comment(" "), + c.parameterName("wid"), + c.comment(""), // syntatic classification verification always just uses input text, so the edits don't appear +); From 66d6e5e6e007ce3ac70b7371c3e7ac46a99a0fcd Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 17 May 2018 15:32:10 -0700 Subject: [PATCH 24/30] Remove leveldown, stip absolute paths from test mk 2, accept reordered and new user baselines (#24227) --- src/harness/externalCompileRunner.ts | 4 +- tests/baselines/reference/user/async.log | 10 +- .../user/chrome-devtools-frontend.log | 105 ++++++++++-------- tests/baselines/reference/user/lodash.log | 22 ++-- tests/baselines/reference/user/log4js.log | 12 -- tests/baselines/reference/user/prettier.log | 8 +- tests/cases/user/leveldown/index.ts | 1 - tests/cases/user/leveldown/package.json | 12 -- tests/cases/user/leveldown/tsconfig.json | 7 -- 9 files changed, 80 insertions(+), 101 deletions(-) delete mode 100644 tests/baselines/reference/user/log4js.log delete mode 100644 tests/cases/user/leveldown/index.ts delete mode 100644 tests/cases/user/leveldown/package.json delete mode 100644 tests/cases/user/leveldown/tsconfig.json diff --git a/src/harness/externalCompileRunner.ts b/src/harness/externalCompileRunner.ts index eac5d92d3e4..8fed742d922 100644 --- a/src/harness/externalCompileRunner.ts +++ b/src/harness/externalCompileRunner.ts @@ -112,11 +112,11 @@ ${stripAbsoluteImportPaths(result.stderr.toString().replace(/\r\n/g, "\n"))}`; * This is problematic for error baselines, so we grep for them and strip them out. */ function stripAbsoluteImportPaths(result: string) { + const workspaceRegexp = new RegExp(Harness.IO.getWorkspaceRoot().replace(/\\/g, "\\\\"), "g"); return result .replace(/import\(".*?\/tests\/cases\/user\//g, `import("/`) .replace(/Module '".*?\/tests\/cases\/user\//g, `Module '"/`) - .replace(/import\(".*?\/TypeScript\/node_modules\//g, `import("../../../node_modules`) - .replace(/Module '".*?\/TypeScript\/node_modules\//g, `Module '"../../../node_modules`); + .replace(workspaceRegexp, "../../.."); } function sortErrors(result: string) { diff --git a/tests/baselines/reference/user/async.log b/tests/baselines/reference/user/async.log index 8c2d96b1b6d..c78c122343c 100644 --- a/tests/baselines/reference/user/async.log +++ b/tests/baselines/reference/user/async.log @@ -43,8 +43,8 @@ node_modules/async/auto.js(159,18): error TS2695: Left side of comma operator is node_modules/async/auto.js(159,50): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/autoInject.js(44,17): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/autoInject.js(134,6): error TS2695: Left side of comma operator is unused and has no side effects. -node_modules/async/autoInject.js(136,25): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/autoInject.js(136,25): error TS2532: Object is possibly 'undefined'. +node_modules/async/autoInject.js(136,25): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/autoInject.js(136,26): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/autoInject.js(139,14): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/autoInject.js(160,28): error TS2695: Left side of comma operator is unused and has no side effects. @@ -145,9 +145,9 @@ node_modules/async/dist/async.js(2963,25): error TS2722: Cannot invoke an object node_modules/async/dist/async.js(2970,25): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/dist/async.js(2971,28): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/dist/async.js(3005,25): error TS2722: Cannot invoke an object which is possibly 'undefined'. +node_modules/async/dist/async.js(3008,9): error TS2532: Object is possibly 'undefined'. node_modules/async/dist/async.js(3008,9): error TS2684: The 'this' context of type 'Function | undefined' is not assignable to method's 'this' of type 'Function'. Type 'undefined' is not assignable to type 'Function'. -node_modules/async/dist/async.js(3008,9): error TS2532: Object is possibly 'undefined'. node_modules/async/dist/async.js(3081,25): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/dist/async.js(3086,25): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/dist/async.js(3087,28): error TS2722: Cannot invoke an object which is possibly 'undefined'. @@ -175,18 +175,18 @@ node_modules/async/dist/async.js(4153,14): error TS2339: Property 'unshift' does node_modules/async/dist/async.js(4367,5): error TS2322: Type 'any[] | {}' is not assignable to type 'any[]'. Type '{}' is not assignable to type 'any[]'. Property 'flatMap' is missing in type '{}'. +node_modules/async/dist/async.js(4603,17): error TS2532: Object is possibly 'undefined'. node_modules/async/dist/async.js(4603,17): error TS2684: The 'this' context of type 'Function | undefined' is not assignable to method's 'this' of type 'Function'. Type 'undefined' is not assignable to type 'Function'. -node_modules/async/dist/async.js(4603,17): error TS2532: Object is possibly 'undefined'. node_modules/async/dist/async.js(4917,19): error TS2339: Property 'code' does not exist on type 'Error'. node_modules/async/dist/async.js(4919,23): error TS2339: Property 'info' does not exist on type 'Error'. node_modules/async/dist/async.js(5090,9): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/dist/async.js(5146,9): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/dist/async.js(5165,20): error TS2339: Property 'unmemoized' does not exist on type 'Function'. node_modules/async/dist/async.js(5208,25): error TS2722: Cannot invoke an object which is possibly 'undefined'. +node_modules/async/dist/async.js(5211,9): error TS2532: Object is possibly 'undefined'. node_modules/async/dist/async.js(5211,9): error TS2684: The 'this' context of type 'Function | undefined' is not assignable to method's 'this' of type 'Function'. Type 'undefined' is not assignable to type 'Function'. -node_modules/async/dist/async.js(5211,9): error TS2532: Object is possibly 'undefined'. node_modules/async/dist/async.js(5315,20): error TS2532: Object is possibly 'undefined'. node_modules/async/dist/async.js(5315,20): error TS2684: The 'this' context of type 'Function | undefined' is not assignable to method's 'this' of type 'Function'. Type 'undefined' is not assignable to type 'Function'. @@ -240,8 +240,8 @@ node_modules/async/eachSeries.js(28,12): error TS2304: Cannot find name 'AsyncFu node_modules/async/eachSeries.js(36,20): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/ensureAsync.js(34,12): error TS2304: Cannot find name 'AsyncFunction'. node_modules/async/ensureAsync.js(36,14): error TS2304: Cannot find name 'AsyncFunction'. -node_modules/async/ensureAsync.js(56,9): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/ensureAsync.js(56,9): error TS2532: Object is possibly 'undefined'. +node_modules/async/ensureAsync.js(56,9): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/async/ensureAsync.js(56,10): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/ensureAsync.js(57,13): error TS2695: Left side of comma operator is unused and has no side effects. node_modules/async/ensureAsync.js(62,18): error TS2695: Left side of comma operator is unused and has no side effects. diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index bcae1ccdf78..7f09fcb11d2 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -3993,9 +3993,9 @@ node_modules/chrome-devtools-frontend/front_end/components/DockController.js(116 node_modules/chrome-devtools-frontend/front_end/components/DockController.js(122,27): error TS2339: Property 'setIsDocked' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/components/DockController.js(193,5): error TS2322: Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarButton'. node_modules/chrome-devtools-frontend/front_end/components/DockController.js(193,5): error TS2322: Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarButton'. node_modules/chrome-devtools-frontend/front_end/components/Linkifier.js(62,24): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/components/Linkifier.js(125,94): error TS2339: Property 'remove' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/components/Linkifier.js(127,41): error TS2339: Property 'remove' does not exist on type 'Map'. @@ -4853,9 +4853,9 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(472,24): e node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(474,27): error TS2339: Property 'isCreationNode' does not exist on type 'DataGridNode'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(591,44): error TS2345: Argument of type 'NODE_TYPE' is not assignable to parameter of type 'DataGridNode'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(595,25): error TS2339: Property 'data' does not exist on type 'NODE_TYPE'. -node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(622,5): error TS2322: Type 'DataGridNode[]' is not assignable to type 'NODE_TYPE[]'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(622,5): error TS2322: Type 'DataGridNode[]' is not assignable to type 'NODE_TYPE[]'. Type 'DataGridNode' is not assignable to type 'NODE_TYPE'. +node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(622,5): error TS2322: Type 'DataGridNode[]' is not assignable to type 'NODE_TYPE[]'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(641,56): error TS2339: Property 'offsetWidth' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(648,37): error TS2339: Property 'offsetWidth' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(649,41): error TS2339: Property 'rows' does not exist on type 'Element'. @@ -5056,10 +5056,10 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(9, node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(9,29): error TS2417: Class static side 'typeof ViewportDataGrid' incorrectly extends base class static side 'typeof DataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ViewportCalculated: symbol; }' is not assignable to type '{ [x: string]: any; SelectedNode: symbol; DeselectedNode: symbol; OpenedNode: symbol; SortingChan...'. - Property 'SelectedNode' is missing in type '{ [x: string]: any; ViewportCalculated: symbol; }'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(9,29): error TS2417: Class static side 'typeof ViewportDataGrid' incorrectly extends base class static side 'typeof DataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ViewportCalculated: symbol; }' is not assignable to type '{ [x: string]: any; SelectedNode: symbol; DeselectedNode: symbol; OpenedNode: symbol; SortingChan...'. + Property 'SelectedNode' is missing in type '{ [x: string]: any; ViewportCalculated: symbol; }'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(11,41): error TS2694: Namespace 'DataGrid' has no exported member 'ColumnDescriptor'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(32,22): error TS2345: Argument of type 'ViewportDataGridNode' is not assignable to parameter of type 'NODE_TYPE'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(43,41): error TS2339: Property 'flatChildren' does not exist on type 'NODE_TYPE'. @@ -5531,10 +5531,10 @@ node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(3 node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(65,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(73,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(84,22): error TS2694: Namespace 'Common' has no exported member 'Event'. +node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(122,5): error TS2322: Type 'Promise>' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(122,5): error TS2322: Type 'Promise>' is not assignable to type 'Promise'. Type 'Map' is not assignable to type 'ComputedStyle'. Property 'node' is missing in type 'Map'. -node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleModel.js(122,5): error TS2322: Type 'Promise>' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js(48,36): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js(51,9): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/elements/ComputedStyleWidget.js(52,49): error TS2555: Expected at least 2 arguments, but got 1. @@ -5582,9 +5582,9 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget. node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget.js(109,26): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget.js(124,5): error TS2322: Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarToggle'. node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget.js(124,5): error TS2322: Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarToggle'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsBreadcrumbs.js(12,46): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsBreadcrumbs.js(86,37): error TS2339: Property 'nextSiblingElement' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsBreadcrumbs.js(104,16): error TS2555: Expected at least 2 arguments, but got 1. @@ -5594,8 +5594,8 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(58,40) node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(90,32): error TS2339: Property 'addEventListener' does not exist on type 'typeof extensionServer'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(98,57): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(116,5): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. - Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(116,5): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. + Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(159,24): error TS2339: Property 'remove' does not exist on type 'ElementsTreeOutline[]'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(180,12): error TS2339: Property 'removeChildren' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsPanel.js(181,12): error TS2339: Property 'createChild' does not exist on type 'Element'. @@ -5764,10 +5764,10 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeElementHigh node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(34,32): error TS2417: Class static side 'typeof ElementsTreeOutline' incorrectly extends base class static side 'typeof TreeOutline'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; SelectedNodeChanged: symbol; ElementsTreeUpdated: symbol; }' is not assignable to type '{ [x: string]: any; ElementAttached: symbol; ElementExpanded: symbol; ElementCollapsed: symbol; E...'. - Property 'ElementAttached' is missing in type '{ [x: string]: any; SelectedNodeChanged: symbol; ElementsTreeUpdated: symbol; }'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(34,32): error TS2417: Class static side 'typeof ElementsTreeOutline' incorrectly extends base class static side 'typeof TreeOutline'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; SelectedNodeChanged: symbol; ElementsTreeUpdated: symbol; }' is not assignable to type '{ [x: string]: any; ElementAttached: symbol; ElementExpanded: symbol; ElementCollapsed: symbol; E...'. + Property 'ElementAttached' is missing in type '{ [x: string]: any; SelectedNodeChanged: symbol; ElementsTreeUpdated: symbol; }'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(45,53): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(49,51): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/elements/ElementsTreeOutline.js(120,24): error TS2694: Namespace 'Elements' has no exported member 'MultilineEditorController'. @@ -6194,9 +6194,9 @@ node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(142,44) node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(169,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(174,57): error TS2339: Property 'window' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(181,27): error TS2339: Property 'setInspectedPageBounds' does not exist on type 'typeof InspectorFrontendHost'. -node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type 'AdvancedApp' is not assignable to type '{ [x: string]: any; presentUI(document: Document): void; }'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type 'AdvancedApp' is not assignable to type '{ [x: string]: any; presentUI(document: Document): void; }'. Property '_rootSplitWidget' does not exist on type '{ [x: string]: any; presentUI(document: Document): void; }'. +node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type 'AdvancedApp' is not assignable to type '{ [x: string]: any; presentUI(document: Document): void; }'. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(9,1): error TS8022: JSDoc '@extends' is not attached to a class. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(50,81): error TS2345: Argument of type 'symbol' is not assignable to parameter of type '{ [x: string]: any; Global: symbol; Local: symbol; Session: symbol; }'. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(52,43): error TS2694: Namespace 'DeviceModeModel' has no exported member 'Type'. @@ -6666,10 +6666,14 @@ node_modules/chrome-devtools-frontend/front_end/externs.js(79,17): error TS2551: node_modules/chrome-devtools-frontend/front_end/externs.js(82,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/externs.js(86,17): error TS2339: Property 'rotate' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/externs.js(90,17): error TS2339: Property 'sortNumbers' does not exist on type 'any[]'. +node_modules/chrome-devtools-frontend/front_end/externs.js(92,13): error TS2304: Cannot find name 'S'. node_modules/chrome-devtools-frontend/front_end/externs.js(96,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/externs.js(100,17): error TS2339: Property 'lowerBound' does not exist on type 'any[]'. +node_modules/chrome-devtools-frontend/front_end/externs.js(102,13): error TS2304: Cannot find name 'S'. node_modules/chrome-devtools-frontend/front_end/externs.js(106,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/externs.js(110,17): error TS2339: Property 'upperBound' does not exist on type 'any[]'. +node_modules/chrome-devtools-frontend/front_end/externs.js(112,13): error TS2304: Cannot find name 'S'. +node_modules/chrome-devtools-frontend/front_end/externs.js(113,22): error TS2304: Cannot find name 'S'. node_modules/chrome-devtools-frontend/front_end/externs.js(114,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/externs.js(118,17): error TS2339: Property 'binaryIndexOf' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/externs.js(125,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. @@ -7699,9 +7703,9 @@ node_modules/chrome-devtools-frontend/front_end/main/Main.js(201,14): error TS25 node_modules/chrome-devtools-frontend/front_end/main/Main.js(202,14): error TS2551: Property 'resourceMapping' does not exist on type 'typeof Bindings'. Did you mean 'ResourceMapping'? node_modules/chrome-devtools-frontend/front_end/main/Main.js(204,5): error TS2322: Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. + Property '_workspace' does not exist on type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(204,5): error TS2322: Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. - Property '_workspace' does not exist on type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(208,5): error TS2322: Type 'ExtensionServer' is not assignable to type 'typeof extensionServer'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(208,5): error TS2322: Type 'ExtensionServer' is not assignable to type 'typeof extensionServer'. Property '_extensionAPITestHook' is missing in type 'ExtensionServer'. @@ -7741,9 +7745,9 @@ node_modules/chrome-devtools-frontend/front_end/main/Main.js(567,65): error TS23 node_modules/chrome-devtools-frontend/front_end/main/Main.js(591,25): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/main/Main.js(599,5): error TS2322: Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarMenuButton'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(599,5): error TS2322: Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarMenuButton'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(608,42): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(609,34): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/main/Main.js(616,41): error TS2555: Expected at least 2 arguments, but got 1. @@ -8136,10 +8140,10 @@ node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(766,59 node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(780,45): error TS2339: Property 'window' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(853,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(867,22): error TS2694: Namespace 'Common' has no exported member 'Event'. -node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(905,5): error TS2322: Type 'ViewportDataGridNode[]' is not assignable to type 'NetworkNode[]'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(905,5): error TS2322: Type 'ViewportDataGridNode[]' is not assignable to type 'NetworkNode[]'. Type 'ViewportDataGridNode' is not assignable to type 'NetworkNode'. Property '_parentView' is missing in type 'ViewportDataGridNode'. +node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(905,5): error TS2322: Type 'ViewportDataGridNode[]' is not assignable to type 'NetworkNode[]'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(916,20): error TS2339: Property 'window' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(938,41): error TS2339: Property 'firstValue' does not exist on type 'Set'. node_modules/chrome-devtools-frontend/front_end/network/NetworkLogView.js(1074,22): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -8567,9 +8571,9 @@ node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameVi node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(241,34): error TS2694: Namespace 'NetworkRequest' has no exported member 'WebSocketFrame'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(250,14): error TS2339: Property 'createTextChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(251,14): error TS2339: Property 'title' does not exist on type 'Element'. -node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(292,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(292,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. Property '_contentURL' does not exist on type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. +node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(292,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(130,29): error TS2339: Property 'localizedFailDescription' does not exist on type 'NetworkRequest'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(150,36): error TS2694: Namespace 'HAREntry' has no exported member 'Timing'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(318,4): error TS1003: Identifier expected. @@ -9213,8 +9217,8 @@ node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(943,8): er node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(944,41): error TS2339: Property 'standardFormatters' does not exist on type 'StringConstructor'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(954,13): error TS2315: Type 'Object' is not generic. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(954,27): error TS1009: Trailing comma not allowed. -node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(954,29): error TS8024: JSDoc '@param' tag has name 'function', but there is no parameter with that name. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(954,29): error TS1005: '>' expected. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(954,29): error TS8024: JSDoc '@param' tag has name 'function', but there is no parameter with that name. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(961,8): error TS2339: Property 'format' does not exist on type 'StringConstructor'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(963,51): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Q'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(978,42): error TS2339: Property 'tokenizeFormatString' does not exist on type 'StringConstructor'. @@ -9232,6 +9236,13 @@ node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1164,15): node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1169,24): error TS2304: Cannot find name 'KEY'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1169,30): error TS2304: Cannot find name 'VALUE'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1171,15): error TS2339: Property 'inverse' does not exist on type 'Map'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1191,14): error TS2304: Cannot find name 'K'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1204,14): error TS2304: Cannot find name 'K'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1215,14): error TS2304: Cannot find name 'K'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1223,14): error TS2304: Cannot find name 'K'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1242,14): error TS2304: Cannot find name 'K'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1257,14): error TS2304: Cannot find name 'K'. +node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1264,23): error TS2304: Cannot find name 'K'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1277,14): error TS2339: Property 'pushAll' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1277,40): error TS2339: Property 'valuesArray' does not exist on type 'Set'. node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1299,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. @@ -9279,9 +9290,9 @@ node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductReg node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryImpl.js(103,67): error TS2694: Namespace 'Registry' has no exported member 'ProductEntry'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(68,9): error TS2322: Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. + Property 'formatValue' is missing in type 'BottomUpProfileDataGridNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(68,9): error TS2322: Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. - Property 'formatValue' is missing in type 'BottomUpProfileDataGridNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(196,26): error TS2339: Property 'UID' does not exist on type 'ProfileNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(197,23): error TS2339: Property 'UID' does not exist on type 'ProfileNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(212,68): error TS2339: Property 'UID' does not exist on type 'ProfileNode'. @@ -9337,8 +9348,8 @@ node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(407,2 node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(31,16): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(33,16): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(43,5): error TS2322: Type 'HeapFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. - Property '_profile' does not exist on type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(43,5): error TS2322: Type 'HeapFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. + Property '_profile' does not exist on type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(52,52): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(54,38): error TS2339: Property 'instance' does not exist on type 'typeof SamplingHeapProfileType'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(82,30): error TS2555: Expected at least 2 arguments, but got 1. @@ -9373,10 +9384,10 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfilerPanel.js(10 node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(34,41): error TS2417: Class static side 'typeof HeapSnapshotSortableDataGrid' incorrectly extends base class static side 'typeof DataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }' is not assignable to type '{ [x: string]: any; SelectedNode: symbol; DeselectedNode: symbol; OpenedNode: symbol; SortingChan...'. - Property 'SelectedNode' is missing in type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(34,41): error TS2417: Class static side 'typeof HeapSnapshotSortableDataGrid' incorrectly extends base class static side 'typeof DataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }' is not assignable to type '{ [x: string]: any; SelectedNode: symbol; DeselectedNode: symbol; OpenedNode: symbol; SortingChan...'. + Property 'SelectedNode' is missing in type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(37,41): error TS2694: Namespace 'DataGrid' has no exported member 'ColumnDescriptor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(124,27): error TS2339: Property 'enclosingNodeOrSelfWithNodeName' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(137,46): error TS2555: Expected at least 2 arguments, but got 1. @@ -9453,10 +9464,10 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(137,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(155,48): error TS2339: Property 'baseSystemDistance' does not exist on type 'typeof HeapSnapshotModel'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(156,95): error TS2555: Expected at least 2 arguments, but got 1. +node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(163,5): error TS2322: Type '({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...' is not assignable to type 'DataGridNode[]'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(163,5): error TS2322: Type '({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...' is not assignable to type 'DataGridNode[]'. Type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...' is not assignable to type 'DataGridNode'. Property '_element' is missing in type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(163,5): error TS2322: Type '({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...' is not assignable to type 'DataGridNode[]'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(170,39): error TS2345: Argument of type 'this' is not assignable to parameter of type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Type 'HeapSnapshotGridNode' is not assignable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Type 'HeapSnapshotGridNode' is not assignable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. @@ -9490,17 +9501,17 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(602,75): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(682,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotObjectNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. - Property '_worker' does not exist on type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(682,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotObjectNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. + Property '_worker' does not exist on type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(871,36): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(874,34): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(892,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotInstanceNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(892,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotInstanceNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(966,23): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(968,29): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(969,30): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. @@ -9533,10 +9544,10 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1183,65): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1191,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotDiffNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. Type '() => HeapSnapshotDiffNodesProvider' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. - Property '_addedNodesProvider' does not exist on type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1191,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotDiffNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. Type '() => HeapSnapshotDiffNodesProvider' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. + Property '_addedNodesProvider' does not exist on type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1194,14): error TS2339: Property 'snapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1194,53): error TS2339: Property 'baseSnapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1195,14): error TS2339: Property 'baseSnapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. @@ -9585,12 +9596,12 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(254 node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(256,17): error TS2345: Argument of type 'ToolbarText' is not assignable to parameter of type 'ToolbarComboBox | ToolbarInput'. Type 'ToolbarText' is not assignable to type 'ToolbarInput'. Property '_prompt' is missing in type 'ToolbarText'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(257,5): error TS2322: Type '(ToolbarComboBox | ToolbarInput)[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(257,5): error TS2322: Type '(ToolbarComboBox | ToolbarInput)[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. Type 'ToolbarComboBox | ToolbarInput' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarComboBox' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarComboBox' is not assignable to type '{ [x: string]: any; item(): any & any; }'. Property 'item' is missing in type 'ToolbarComboBox'. +node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(257,5): error TS2322: Type '(ToolbarComboBox | ToolbarInput)[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(344,50): error TS2551: Property 'jumpBackwards' does not exist on type 'SearchConfig'. Did you mean 'jumpBackward'? node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(397,25): error TS2339: Property '_loadPromise' does not exist on type 'ProfileHeader'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotView.js(405,24): error TS2345: Argument of type 'SearchConfig' is not assignable to parameter of type 'SearchConfig'. @@ -11269,9 +11280,9 @@ node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(718,33): err node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(728,32): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(731,3): error TS2416: Property 'callFunctionJSON' in type 'RemoteObjectImpl' is not assignable to the same property in base type 'RemoteObject'. Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. - Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(731,3): error TS2416: Property 'callFunctionJSON' in type 'RemoteObjectImpl' is not assignable to the same property in base type 'RemoteObject'. Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. + Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(741,52): error TS2339: Property 'Error' does not exist on type 'typeof Protocol'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(795,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(797,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. @@ -11290,10 +11301,10 @@ node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1179,3): err Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1234,21): error TS2694: Namespace 'SDK' has no exported member 'CallFunctionResult'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1265,21): error TS2694: Namespace 'SDK' has no exported member 'CallFunctionResult'. +node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1325,5): error TS2322: Type 'Promise<{ properties: RemoteObjectProperty[]; internalProperties: RemoteObjectProperty[]; }>' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1325,5): error TS2322: Type 'Promise<{ properties: RemoteObjectProperty[]; internalProperties: RemoteObjectProperty[]; }>' is not assignable to type 'Promise'. Type '{ properties: RemoteObjectProperty[]; internalProperties: RemoteObjectProperty[]; }' is not assignable to type 'RemoteObject'. Property 'customPreview' is missing in type '{ properties: RemoteObjectProperty[]; internalProperties: RemoteObjectProperty[]; }'. -node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1325,5): error TS2322: Type 'Promise<{ properties: RemoteObjectProperty[]; internalProperties: RemoteObjectProperty[]; }>' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1345,43): error TS2694: Namespace 'DebuggerModel' has no exported member 'FunctionDetails'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1352,45): error TS2694: Namespace 'DebuggerModel' has no exported member 'FunctionDetails'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(1363,35): error TS2694: Namespace 'DebuggerModel' has no exported member 'FunctionDetails'. @@ -11361,11 +11372,11 @@ node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(173,5): erro Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(179,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. -node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(184,5): error TS2322: Type 'ScopeRemoteObject' is not assignable to type 'RemoteObject'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(184,5): error TS2322: Type 'ScopeRemoteObject' is not assignable to type 'RemoteObject'. Types of property 'callFunctionJSON' are incompatible. Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. +node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(184,5): error TS2322: Type 'ScopeRemoteObject' is not assignable to type 'RemoteObject'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(199,40): error TS2339: Property 'Runtime' does not exist on type 'typeof Protocol'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(201,40): error TS2339: Property 'Runtime' does not exist on type 'typeof Protocol'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(203,40): error TS2339: Property 'Runtime' does not exist on type 'typeof Protocol'. @@ -11598,8 +11609,8 @@ node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(347,36): er node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(351,35): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(356,52): error TS2694: Namespace 'Connection' has no exported member 'Params'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(364,7): error TS2322: Type 'WebSocketConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. - Property '_socket' does not exist on type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(364,7): error TS2322: Type 'WebSocketConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. + Property '_socket' does not exist on type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(365,38): error TS2339: Property 'isHostedMode' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(366,7): error TS2322: Type 'StubConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(366,7): error TS2322: Type 'StubConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. @@ -11638,10 +11649,10 @@ node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(133,42): err node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(179,34): error TS2694: Namespace 'TracingManager' has no exported member 'EventPayload'. node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(250,47): error TS2339: Property 'id' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(254,37): error TS2339: Property 'id' does not exist on type 'Event'. -node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(283,5): error TS2322: Type 'NamedObject[]' is not assignable to type 'Process[]'. node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(283,5): error TS2322: Type 'NamedObject[]' is not assignable to type 'Process[]'. Type 'NamedObject' is not assignable to type 'Process'. Property '_threads' is missing in type 'NamedObject'. +node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(283,5): error TS2322: Type 'NamedObject[]' is not assignable to type 'Process[]'. node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(283,65): error TS2339: Property 'valuesArray' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(305,23): error TS2339: Property 'stableSort' does not exist on type 'Event[]'. node_modules/chrome-devtools-frontend/front_end/sdk/TracingModel.js(308,49): error TS2345: Argument of type '{ [x: string]: any; Begin: string; End: string; Complete: string; Instant: string; AsyncBegin: st...' is not assignable to parameter of type 'string'. @@ -11901,8 +11912,8 @@ node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(51,48 node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(54,43): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(69,55): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(85,5): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. - Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(85,5): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. + Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(100,15): error TS2339: Property 'keyCode' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(119,31): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(121,42): error TS2339: Property 'createChild' does not exist on type 'Element'. @@ -11928,8 +11939,8 @@ node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(336,3 node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(351,31): error TS2339: Property 'bringToFront' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(70,35): error TS2339: Property 'remove' does not exist on type 'Map'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(113,5): error TS2322: Type 'SnippetsProject' is not assignable to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. - Property '_model' does not exist on type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(113,5): error TS2322: Type 'SnippetsProject' is not assignable to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. + Property '_model' does not exist on type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(137,18): error TS2339: Property 'addEventListener' does not exist on type 'UISourceCode'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(146,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(165,36): error TS2339: Property 'remove' does not exist on type 'Map'. @@ -12017,11 +12028,11 @@ node_modules/chrome-devtools-frontend/front_end/source_frame/SourceCodeDiff.js(2 node_modules/chrome-devtools-frontend/front_end/source_frame/SourceCodeDiff.js(283,22): error TS2339: Property 'setGutterDecoration' does not exist on type 'CodeMirrorTextEditor'. node_modules/chrome-devtools-frontend/front_end/source_frame/SourceCodeDiff.js(284,22): error TS2339: Property 'toggleLineClass' does not exist on type 'CodeMirrorTextEditor'. node_modules/chrome-devtools-frontend/front_end/source_frame/SourceFrame.js(41,11): error TS2555: Expected at least 2 arguments, but got 1. +node_modules/chrome-devtools-frontend/front_end/source_frame/SourceFrame.js(115,5): error TS2322: Type 'ToolbarText[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/source_frame/SourceFrame.js(115,5): error TS2322: Type 'ToolbarText[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. Type 'ToolbarText' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarText' is not assignable to type '{ [x: string]: any; item(): any & any; }'. Property 'item' is missing in type 'ToolbarText'. -node_modules/chrome-devtools-frontend/front_end/source_frame/SourceFrame.js(115,5): error TS2322: Type 'ToolbarText[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/source_frame/SourceFrame.js(371,32): error TS2339: Property 'lowerBound' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/source_frame/SourceFrame.js(435,15): error TS2339: Property '__fromRegExpQuery' does not exist on type 'RegExp'. node_modules/chrome-devtools-frontend/front_end/source_frame/SourceFrame.js(459,15): error TS2339: Property '__fromRegExpQuery' does not exist on type 'RegExp'. @@ -12201,8 +12212,8 @@ node_modules/chrome-devtools-frontend/front_end/sources/CallStackSidebarPane.js( node_modules/chrome-devtools-frontend/front_end/sources/CallStackSidebarPane.js(415,65): error TS1138: Parameter declaration expected. node_modules/chrome-devtools-frontend/front_end/sources/CallStackSidebarPane.js(415,65): error TS8024: JSDoc '@param' tag has name 'function', but there is no parameter with that name. node_modules/chrome-devtools-frontend/front_end/sources/CallStackSidebarPane.js(429,2): error TS1131: Property or signature expected. -node_modules/chrome-devtools-frontend/front_end/sources/CallStackSidebarPane.js(435,30): error TS2339: Property 'Item' does not exist on type 'typeof CallStackSidebarPane'. node_modules/chrome-devtools-frontend/front_end/sources/CallStackSidebarPane.js(435,30): error TS2300: Duplicate identifier 'Item'. +node_modules/chrome-devtools-frontend/front_end/sources/CallStackSidebarPane.js(435,30): error TS2339: Property 'Item' does not exist on type 'typeof CallStackSidebarPane'. node_modules/chrome-devtools-frontend/front_end/sources/DebuggerPausedMessage.js(11,33): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'. node_modules/chrome-devtools-frontend/front_end/sources/DebuggerPausedMessage.js(54,37): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sources/DebuggerPausedMessage.js(56,37): error TS2555: Expected at least 2 arguments, but got 1. @@ -12221,8 +12232,8 @@ node_modules/chrome-devtools-frontend/front_end/sources/EventListenerBreakpoints node_modules/chrome-devtools-frontend/front_end/sources/EventListenerBreakpointsSidebarPane.js(24,113): error TS2694: Namespace 'EventListenerBreakpointsSidebarPane' has no exported member 'Item'. node_modules/chrome-devtools-frontend/front_end/sources/EventListenerBreakpointsSidebarPane.js(57,33): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/EventListenerBreakpointsSidebarPane.js(125,64): error TS1003: Identifier expected. -node_modules/chrome-devtools-frontend/front_end/sources/EventListenerBreakpointsSidebarPane.js(126,45): error TS2339: Property 'Item' does not exist on type 'typeof EventListenerBreakpointsSidebarPane'. node_modules/chrome-devtools-frontend/front_end/sources/EventListenerBreakpointsSidebarPane.js(126,45): error TS2300: Duplicate identifier 'Item'. +node_modules/chrome-devtools-frontend/front_end/sources/EventListenerBreakpointsSidebarPane.js(126,45): error TS2339: Property 'Item' does not exist on type 'typeof EventListenerBreakpointsSidebarPane'. node_modules/chrome-devtools-frontend/front_end/sources/FilteredUISourceCodeListProvider.js(20,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/sources/FilteredUISourceCodeListProvider.js(140,21): error TS2339: Property 'title' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/FilteredUISourceCodeListProvider.js(159,13): error TS2339: Property 'removeChildren' does not exist on type 'Element'. @@ -12632,8 +12643,8 @@ node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(108,25): node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(113,15): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(113,48): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(134,52): error TS2694: Namespace 'KeyboardShortcut' has no exported member 'Descriptor'. -node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(134,65): error TS8024: JSDoc '@param' tag has name 'function', but there is no parameter with that name. node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(134,65): error TS1138: Parameter declaration expected. +node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(134,65): error TS8024: JSDoc '@param' tag has name 'function', but there is no parameter with that name. node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(139,45): error TS2694: Namespace 'KeyboardShortcut' has no exported member 'Descriptor'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(190,43): error TS2694: Namespace 'KeyboardShortcut' has no exported member 'Descriptor'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesView.js(287,22): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -12790,11 +12801,11 @@ node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPan node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(15,46): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(16,38): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(21,44): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(34,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(34,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. Property 'item' is missing in type 'ToolbarButton'. +node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(34,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(39,45): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(47,41): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sources/XHRBreakpointsSidebarPane.js(49,46): error TS2339: Property 'createChild' does not exist on type 'Element'. @@ -13121,8 +13132,8 @@ node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1016,1 node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1025,32): error TS2339: Property '_pageLoadedCallback' does not exist on type 'typeof TestRunner'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1031,14): error TS2339: Property '_pageLoadedCallback' does not exist on type 'typeof TestRunner'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1035,18): error TS1099: Type argument list cannot be empty. -node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1035,19): error TS8024: JSDoc '@param' tag has name 'function', but there is no parameter with that name. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1035,19): error TS1005: '>' expected. +node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1035,19): error TS8024: JSDoc '@param' tag has name 'function', but there is no parameter with that name. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1129,21): error TS2339: Property 'resourceTreeModel' does not exist on type 'typeof TestRunner'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1192,15): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/test_runner/TestRunner.js(1203,19): error TS2339: Property 'naturalOrderComparator' does not exist on type 'StringConstructor'. @@ -13186,8 +13197,8 @@ node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor.js(1052,23): error TS2339: Property 'valuesArray' does not exist on type 'Multimap'. node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor.js(1053,23): error TS2339: Property 'clear' does not exist on type 'Multimap'. node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor.js(1261,5): error TS2322: Type 'CodeMirrorPositionHandle' is not assignable to type '{ [x: string]: any; resolve(): { lineNumber: number; columnNumber: number; }; equal(positionHandl...'. - Property '_codeMirror' does not exist on type '{ [x: string]: any; resolve(): { lineNumber: number; columnNumber: number; }; equal(positionHandl...'. node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor.js(1261,5): error TS2322: Type 'CodeMirrorPositionHandle' is not assignable to type '{ [x: string]: any; resolve(): { lineNumber: number; columnNumber: number; }; equal(positionHandl...'. + Property '_codeMirror' does not exist on type '{ [x: string]: any; resolve(): { lineNumber: number; columnNumber: number; }; equal(positionHandl...'. node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor.js(1301,31): error TS2339: Property 'listSelections' does not exist on type 'CodeMirror'. node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor.js(1305,38): error TS2339: Property 'findMatchingBracket' does not exist on type 'CodeMirror'. node_modules/chrome-devtools-frontend/front_end/text_editor/CodeMirrorTextEditor.js(1313,14): error TS2339: Property 'setSelections' does not exist on type 'CodeMirror'. @@ -13273,8 +13284,8 @@ node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(21,39): error node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(51,31): error TS2694: Namespace 'Text' has no exported member 'Position'. node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(55,34): error TS2339: Property 'lowerBound' does not exist on type 'number[]'. node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(121,59): error TS1003: Identifier expected. -node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(122,16): error TS2339: Property 'Position' does not exist on type 'typeof Text'. node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(122,16): error TS2300: Duplicate identifier 'Position'. +node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(122,16): error TS2339: Property 'Position' does not exist on type 'typeof Text'. node_modules/chrome-devtools-frontend/front_end/text_utils/Text.js(160,42): error TS2339: Property 'lowerBound' does not exist on type 'number[]'. node_modules/chrome-devtools-frontend/front_end/text_utils/TextRange.js(84,31): error TS2339: Property 'computeLineEndings' does not exist on type 'string'. node_modules/chrome-devtools-frontend/front_end/text_utils/TextUtils.js(30,11): error TS2339: Property 'TextUtils' does not exist on type 'typeof TextUtils'. @@ -13619,9 +13630,9 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(28,41 node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(43,14): error TS2339: Property '_reportErrorAndCancelLoading' does not exist on type 'typeof TimelineLoader'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(45,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. + Property 'loadingStarted' is missing in type 'TimelineLoader'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(45,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. - Property 'loadingStarted' is missing in type 'TimelineLoader'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(56,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(56,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. @@ -13773,24 +13784,24 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(590 node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(696,14): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(698,14): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(712,24): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(717,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(717,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. Property 'icon' is missing in type '{ name: string; color: string; }'. +node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(717,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(727,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. Property 'icon' is missing in type '{ name: string; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(727,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(731,13): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(733,9): error TS2322: Type '{ name: any; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. - Property 'icon' is missing in type '{ name: any; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(733,9): error TS2322: Type '{ name: any; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. + Property 'icon' is missing in type '{ name: any; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(743,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'name' must be of type 'any', but here has type 'string'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(753,91): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(754,9): error TS2322: Type '{ name: any; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. Property 'icon' is missing in type '{ name: any; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(754,9): error TS2322: Type '{ name: any; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(759,5): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. - Property 'icon' is missing in type '{ name: string; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(759,5): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. + Property 'icon' is missing in type '{ name: string; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(770,15): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(771,15): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(772,15): error TS2555: Expected at least 2 arguments, but got 1. @@ -14487,8 +14498,8 @@ node_modules/chrome-devtools-frontend/front_end/ui/FilterBar.js(351,46): error T node_modules/chrome-devtools-frontend/front_end/ui/FilterBar.js(351,59): error TS2339: Property 'shiftKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/FilterBar.js(352,37): error TS2339: Property 'typeName' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/ui/FilterBar.js(374,73): error TS1003: Identifier expected. -node_modules/chrome-devtools-frontend/front_end/ui/FilterBar.js(375,24): error TS2339: Property 'Item' does not exist on type 'typeof NamedBitSetFilterUI'. node_modules/chrome-devtools-frontend/front_end/ui/FilterBar.js(375,24): error TS2300: Duplicate identifier 'Item'. +node_modules/chrome-devtools-frontend/front_end/ui/FilterBar.js(375,24): error TS2339: Property 'Item' does not exist on type 'typeof NamedBitSetFilterUI'. node_modules/chrome-devtools-frontend/front_end/ui/FilterSuggestionBuilder.js(21,39): error TS2694: Namespace 'SuggestBox' has no exported member 'Suggestions'. node_modules/chrome-devtools-frontend/front_end/ui/ForwardedInputEventHandler.js(14,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/Fragment.js(12,49): error TS2694: Namespace 'Fragment' has no exported member '_State'. @@ -14595,9 +14606,9 @@ node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(62,31): erro node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(69,40): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(80,24): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(92,51): error TS2339: Property 'runtime' does not exist on type 'Window'. -node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(116,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(116,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. +node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(116,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(118,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(118,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. @@ -14995,8 +15006,8 @@ node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(58,15): error T node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(70,18): error TS2694: Namespace 'UI' has no exported member 'AutocompleteConfig'. node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(79,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(91,2): error TS1131: Property or signature expected. -node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(101,15): error TS2339: Property 'Options' does not exist on type '{ (): void; Events: { [x: string]: any; TextChanged: symbol; }; }'. node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(101,15): error TS2300: Duplicate identifier 'Options'. +node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(101,15): error TS2339: Property 'Options' does not exist on type '{ (): void; Events: { [x: string]: any; TextChanged: symbol; }; }'. node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(105,2): error TS1131: Property or signature expected. node_modules/chrome-devtools-frontend/front_end/ui/TextEditor.js(111,4): error TS2339: Property 'AutocompleteConfig' does not exist on type 'typeof UI'. node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(52,74): error TS2694: Namespace 'SuggestBox' has no exported member 'Suggestions'. @@ -15028,8 +15039,8 @@ node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(601,32): error node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(610,54): error TS2339: Property 'isAncestor' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(622,35): error TS2339: Property 'getComponentSelection' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(627,7): error TS2322: Type 'Node' is not assignable to type 'Element'. - Property 'assignedSlot' is missing in type 'Node'. node_modules/chrome-devtools-frontend/front_end/ui/TextPrompt.js(627,7): error TS2322: Type 'Node' is not assignable to type 'Element'. + Property 'assignedSlot' is missing in type 'Node'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(43,50): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(48,45): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(75,24): error TS2694: Namespace 'Common' has no exported member 'Event'. @@ -15050,9 +15061,9 @@ node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(318,56): error TS2 node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(328,27): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(343,36): error TS2352: Type 'ToolbarSeparator' cannot be converted to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarSeparator' is not comparable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarSeparator'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(343,36): error TS2352: Type 'ToolbarSeparator' cannot be converted to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarSeparator' is not comparable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarSeparator'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(346,17): error TS2352: Type 'ToolbarToggle' cannot be converted to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not comparable to type '{ [x: string]: any; item(): any & any; }'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(346,17): error TS2352: Type 'ToolbarToggle' cannot be converted to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. diff --git a/tests/baselines/reference/user/lodash.log b/tests/baselines/reference/user/lodash.log index 53443ad51be..d148b5e8ef1 100644 --- a/tests/baselines/reference/user/lodash.log +++ b/tests/baselines/reference/user/lodash.log @@ -38,9 +38,9 @@ node_modules/lodash/_baseDifference.js(43,5): error TS2322: Type 'SetCache' is n node_modules/lodash/_baseDifference.js(60,15): error TS2554: Expected 2 arguments, but got 3. node_modules/lodash/_baseFlatten.js(19,17): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'. Type '(value: any) => boolean' is not assignable to type 'false'. +node_modules/lodash/_baseFlatten.js(24,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Boolean' has no compatible call signatures. node_modules/lodash/_baseFlatten.js(24,22): error TS2532: Object is possibly 'undefined'. node_modules/lodash/_baseFlatten.js(24,22): error TS2722: Cannot invoke an object which is possibly 'undefined'. -node_modules/lodash/_baseFlatten.js(24,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Boolean' has no compatible call signatures. node_modules/lodash/_baseIntersection.js(53,40): error TS2345: Argument of type 'Function | undefined' is not assignable to parameter of type 'Function'. Type 'undefined' is not assignable to type 'Function'. node_modules/lodash/_baseIntersection.js(60,54): error TS2345: Argument of type 'Function | undefined' is not assignable to parameter of type 'Function'. @@ -180,8 +180,8 @@ node_modules/lodash/core.js(68,58): error TS2339: Property 'Object' does not exi node_modules/lodash/core.js(77,82): error TS2339: Property 'nodeType' does not exist on type 'NodeModule'. node_modules/lodash/core.js(540,19): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'. Type '(value: any) => boolean' is not assignable to type 'false'. -node_modules/lodash/core.js(545,24): error TS2532: Object is possibly 'undefined'. node_modules/lodash/core.js(545,24): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Boolean' has no compatible call signatures. +node_modules/lodash/core.js(545,24): error TS2532: Object is possibly 'undefined'. node_modules/lodash/core.js(545,24): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/lodash/core.js(664,42): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number'. node_modules/lodash/core.js(721,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'result' must be of type 'boolean', but here has type 'any'. @@ -218,8 +218,8 @@ node_modules/lodash/core.js(1566,33): error TS2554: Expected 1 arguments, but go node_modules/lodash/core.js(1709,41): error TS2532: Object is possibly 'undefined'. node_modules/lodash/core.js(1872,12): error TS1003: Identifier expected. node_modules/lodash/core.js(1872,12): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -node_modules/lodash/core.js(2142,12): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/core.js(2142,12): error TS1003: Identifier expected. +node_modules/lodash/core.js(2142,12): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/core.js(2183,41): error TS8024: JSDoc '@param' tag has name 'iteratees', but there is no parameter with that name. node_modules/lodash/core.js(2473,21): error TS2554: Expected 0 arguments, but got 1. node_modules/lodash/core.js(2609,39): error TS2554: Expected 0 arguments, but got 1. @@ -235,11 +235,11 @@ node_modules/lodash/core.js(3830,45): error TS2304: Cannot find name 'define'. node_modules/lodash/core.js(3830,71): error TS2304: Cannot find name 'define'. node_modules/lodash/core.js(3839,5): error TS2304: Cannot find name 'define'. node_modules/lodash/core.js(3846,35): error TS2339: Property '_' does not exist on type 'typeof lodash'. -node_modules/lodash/curry.js(24,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/curry.js(24,10): error TS1003: Identifier expected. +node_modules/lodash/curry.js(24,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/curry.js(50,10): error TS2339: Property 'placeholder' does not exist on type 'Function'. -node_modules/lodash/curryRight.js(21,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/curryRight.js(21,10): error TS1003: Identifier expected. +node_modules/lodash/curryRight.js(21,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/curryRight.js(47,10): error TS2339: Property 'placeholder' does not exist on type 'Function'. node_modules/lodash/debounce.js(83,17): error TS2532: Object is possibly 'undefined'. node_modules/lodash/debounce.js(84,27): error TS2532: Object is possibly 'undefined'. @@ -255,15 +255,15 @@ node_modules/lodash/differenceBy.js(40,52): error TS2345: Argument of type '(val node_modules/lodash/differenceBy.js(40,78): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/differenceWith.js(36,52): error TS2345: Argument of type '(value: any) => boolean' is not assignable to parameter of type 'boolean | undefined'. Type '(value: any) => boolean' is not assignable to type 'false'. -node_modules/lodash/drop.js(13,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/drop.js(13,10): error TS1003: Identifier expected. +node_modules/lodash/drop.js(13,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/dropRight.js(13,10): error TS1003: Identifier expected. node_modules/lodash/dropRight.js(13,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/dropRightWhile.js(41,24): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/dropWhile.js(41,24): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/escape.js(39,39): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(substring: string, ...args: any[]) => string'. -node_modules/lodash/every.js(23,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/every.js(23,10): error TS1003: Identifier expected. +node_modules/lodash/every.js(23,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/every.js(53,27): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/filter.js(45,27): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/findIndex.js(52,31): error TS2554: Expected 0-1 arguments, but got 2. @@ -371,10 +371,10 @@ node_modules/lodash/remove.js(41,15): error TS2554: Expected 0-1 arguments, but node_modules/lodash/repeat.js(15,10): error TS1003: Identifier expected. node_modules/lodash/repeat.js(15,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/replace.js(15,29): error TS8029: JSDoc '@param' tag has name 'replacement', but there is no parameter with that name. It would match 'arguments' if it had an array type. -node_modules/lodash/sampleSize.js(17,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/sampleSize.js(17,10): error TS1003: Identifier expected. -node_modules/lodash/some.js(18,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. +node_modules/lodash/sampleSize.js(17,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/some.js(18,10): error TS1003: Identifier expected. +node_modules/lodash/some.js(18,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/some.js(48,27): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/sortedIndexBy.js(30,42): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/sortedLastIndexBy.js(30,42): error TS2554: Expected 0-1 arguments, but got 2. @@ -388,8 +388,8 @@ node_modules/lodash/takeRight.js(13,10): error TS1003: Identifier expected. node_modules/lodash/takeRight.js(13,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/takeRightWhile.js(41,24): error TS2554: Expected 0-1 arguments, but got 2. node_modules/lodash/takeWhile.js(41,24): error TS2554: Expected 0-1 arguments, but got 2. -node_modules/lodash/template.js(65,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/template.js(65,10): error TS1003: Identifier expected. +node_modules/lodash/template.js(65,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/template.js(146,34): error TS2532: Object is possibly 'undefined'. node_modules/lodash/template.js(153,21): error TS2532: Object is possibly 'undefined'. node_modules/lodash/template.js(158,6): error TS2532: Object is possibly 'undefined'. @@ -414,8 +414,8 @@ node_modules/lodash/transform.js(59,3): error TS2349: Cannot invoke an expressio node_modules/lodash/transform.js(60,12): error TS2722: Cannot invoke an object which is possibly 'undefined'. node_modules/lodash/trim.js(20,10): error TS1003: Identifier expected. node_modules/lodash/trim.js(20,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. -node_modules/lodash/trimEnd.js(19,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/trimEnd.js(19,10): error TS1003: Identifier expected. +node_modules/lodash/trimEnd.js(19,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/trimStart.js(19,10): error TS1003: Identifier expected. node_modules/lodash/trimStart.js(19,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name. node_modules/lodash/truncate.js(60,36): error TS2532: Object is possibly 'undefined'. diff --git a/tests/baselines/reference/user/log4js.log b/tests/baselines/reference/user/log4js.log deleted file mode 100644 index 0e0765ae359..00000000000 --- a/tests/baselines/reference/user/log4js.log +++ /dev/null @@ -1,12 +0,0 @@ -Exit Code: 1 -Standard output: -node_modules/log4js/types/log4js.d.ts(4,2): error TS7008: Member 'getLogger' implicitly has an 'any' type. -node_modules/log4js/types/log4js.d.ts(5,2): error TS7008: Member 'configure' implicitly has an 'any' type. -node_modules/log4js/types/log4js.d.ts(6,2): error TS7008: Member 'addLayout' implicitly has an 'any' type. -node_modules/log4js/types/log4js.d.ts(7,2): error TS7008: Member 'connectLogger' implicitly has an 'any' type. -node_modules/log4js/types/log4js.d.ts(8,2): error TS7008: Member 'levels' implicitly has an 'any' type. -node_modules/log4js/types/log4js.d.ts(9,2): error TS7008: Member 'shutdown' implicitly has an 'any' type. - - - -Standard error: diff --git a/tests/baselines/reference/user/prettier.log b/tests/baselines/reference/user/prettier.log index bced90b04c9..15dd95b4297 100644 --- a/tests/baselines/reference/user/prettier.log +++ b/tests/baselines/reference/user/prettier.log @@ -5,7 +5,7 @@ index.js(138,21): error TS2532: Object is possibly 'undefined'. src/cli/util.js(262,64): error TS2339: Property 'length' does not exist on type 'Ignore'. src/cli/util.js(335,52): error TS2339: Property 'length' does not exist on type 'Ignore'. src/cli/util.js(396,46): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. -src/cli/util.js(403,39): error TS2339: Property 'grey' does not exist on type 'typeof import("E:/Github/TypeScript/node_modules/chalk/types/index")'. +src/cli/util.js(403,39): error TS2339: Property 'grey' does not exist on type 'typeof import("../../../node_modules/chalk/types/index")'. src/common/errors.js(3,7): error TS2300: Duplicate identifier 'ConfigError'. src/common/errors.js(7,3): error TS2300: Duplicate identifier 'ConfigError'. src/common/parser-create-error.js(8,9): error TS2339: Property 'loc' does not exist on type 'SyntaxError'. @@ -76,10 +76,10 @@ src/language-vue/parser-vue.js(398,23): error TS2345: Argument of type '{ [x: st Property 'contentStart' is missing in type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }'. src/language-vue/parser-vue.js(399,9): error TS2322: Type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }' is not assignable to type '{ [x: string]: any; tag: string; attrs: never[]; unary: boolean; start: number; contentStart: num...'. src/main/core-options.js(51,43): error TS1005: '}' expected. -src/main/core-options.js(63,5): error TS2322: Type '{ cursorOffset: { since: string; category: string; type: "int"; default: number; range: { start: ...' is not assignable to type '{ [name: string]: { since: string; category: string; type: "boolean" | "path" | "int" | "choice";...'. +src/main/core-options.js(63,5): error TS2322: Type '{ cursorOffset: { since: string; category: string; type: "int"; default: number; range: { start: ...' is not assignable to type '{ [name: string]: OptionInfo; }'. Property 'cursorOffset' is incompatible with index signature. - Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: num...' is not assignable to type '{ since: string; category: string; type: "boolean" | "path" | "int" | "choice"; array: boolean; d...'. - Object literal may only specify known properties, and 'cliCategory' does not exist in type '{ since: string; category: string; type: "boolean" | "path" | "int" | "choice"; array: boolean; d...'. + Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: num...' is not assignable to type 'OptionInfo'. + Object literal may only specify known properties, and 'cliCategory' does not exist in type 'OptionInfo'. src/main/parser.js(61,9): error TS2345: Argument of type 'PropertyDescriptor | undefined' is not assignable to parameter of type 'PropertyDescriptor & ThisType'. Type 'undefined' is not assignable to type 'PropertyDescriptor & ThisType'. Type 'undefined' is not assignable to type 'PropertyDescriptor'. diff --git a/tests/cases/user/leveldown/index.ts b/tests/cases/user/leveldown/index.ts deleted file mode 100644 index c595cfc3198..00000000000 --- a/tests/cases/user/leveldown/index.ts +++ /dev/null @@ -1 +0,0 @@ -import leveldown = require("leveldown"); diff --git a/tests/cases/user/leveldown/package.json b/tests/cases/user/leveldown/package.json deleted file mode 100644 index 4ee61ed4ba4..00000000000 --- a/tests/cases/user/leveldown/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "leveldown-test", - "version": "1.0.0", - "description": "", - "main": "index.js", - "author": "", - "license": "Apache-2.0", - "dependencies": { - "@types/node": "^8.0.47", - "leveldown": "latest" - } -} diff --git a/tests/cases/user/leveldown/tsconfig.json b/tests/cases/user/leveldown/tsconfig.json deleted file mode 100644 index cb2b47ac078..00000000000 --- a/tests/cases/user/leveldown/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "lib": ["esnext", "dom"], - "types": ["node"] - } -} From 49989619db1ebd252650a57ab80a0a72b163b7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E7=92=90?= Date: Fri, 18 May 2018 09:34:14 +0800 Subject: [PATCH 25/30] simply quick fix for import type missing typeof --- .../fixAddModuleReferTypeMissingTypeof.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts index 8b58dba5450..15d282342ea 100644 --- a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -7,10 +7,8 @@ namespace ts.codefix { errorCodes, getCodeActions: context => { const { sourceFile, span } = context; - const typeContainer = getImportTypeNode(sourceFile, span.start); - if (!typeContainer) return undefined; - - const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, typeContainer)); + const importType = getImportTypeNode(sourceFile, span.start); + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, importType)); return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_typeof, fixId, Diagnostics.Add_missing_typeof)]; }, fixIds: [fixId], @@ -18,15 +16,15 @@ namespace ts.codefix { doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start!))), }); - function getImportTypeNode(sourceFile: SourceFile, pos: number): ImportTypeNode | undefined { + function getImportTypeNode(sourceFile: SourceFile, pos: number): ImportTypeNode { const token = getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false); Debug.assert(token.kind === SyntaxKind.ImportKeyword); Debug.assert(token.parent.kind === SyntaxKind.ImportType); return token.parent; } - function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, typeContainer: ImportTypeNode) { - const newTypeNode = updateImportTypeNode(typeContainer, typeContainer.argument, typeContainer.qualifier, typeContainer.typeArguments, /* isTypeOf */ true); - changes.replaceNode(sourceFile, typeContainer, newTypeNode); + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, importType: ImportTypeNode) { + const newTypeNode = updateImportTypeNode(importType, importType.argument, importType.qualifier, importType.typeArguments, /* isTypeOf */ true); + changes.replaceNode(sourceFile, importType, newTypeNode); } } From 45c06cfd11c24a24b69e0ca0e775d9f5601b14ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E7=92=90?= Date: Fri, 18 May 2018 10:07:45 +0800 Subject: [PATCH 26/30] only allow refactor if selected span overlaps name declaration --- .../generateGetAccessorAndSetAccessor.ts | 22 ++++++------- ...efactorConvertToGetAccessAndSetAccess35.ts | 32 +++++++++++++++---- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index d68a052eca9..92d87b1fcd0 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -21,8 +21,8 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { } function getAvailableActions(context: RefactorContext): ApplicableRefactorInfo[] | undefined { - const { file, startPosition } = context; - if (!getConvertibleFieldAtPosition(file, startPosition)) return undefined; + const { file } = context; + if (!getConvertibleFieldAtPosition(context, file)) return undefined; return [{ name: actionName, @@ -37,9 +37,9 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { } function getEditsForAction(context: RefactorContext, _actionName: string): RefactorEditInfo | undefined { - const { file, startPosition } = context; + const { file } = context; - const fieldInfo = getConvertibleFieldAtPosition(file, startPosition); + const fieldInfo = getConvertibleFieldAtPosition(context, file); if (!fieldInfo) return undefined; const isJS = isSourceFileJavaScript(file); @@ -117,17 +117,15 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor { return name.charCodeAt(0) === CharacterCodes._; } - function getConvertibleFieldAtPosition(file: SourceFile, startPosition: number): Info | undefined { + function getConvertibleFieldAtPosition(context: RefactorContext, file: SourceFile): Info | undefined { + const { startPosition, endPosition } = context; + const node = getTokenAtPosition(file, startPosition, /*includeJsDocComment*/ false); - const declaration = findAncestor(node.parent, n => { - if (isFunctionLikeDeclaration(n)) { - return "quit"; - } - return isAcceptedDeclaration(n); - }); + const declaration = findAncestor(node.parent, isAcceptedDeclaration); // make sure declaration have AccessibilityModifier or Static Modifier or Readonly Modifier const meaning = ModifierFlags.AccessibilityModifier | ModifierFlags.Static | ModifierFlags.Readonly; - if (!declaration || !isConvertableName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined; + if (!declaration || !rangeOverlapsWithStartEnd(declaration.name, startPosition, endPosition) + || !isConvertableName(declaration.name) || (getModifierFlags(declaration) | meaning) !== meaning) return undefined; const name = declaration.name.text; const startWithUnderscore = startsWithUnderscore(name); diff --git a/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts b/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts index f1b306fa4b9..35e707b49d0 100644 --- a/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts +++ b/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess35.ts @@ -5,25 +5,45 @@ //// /*e*/return/*f*/ /*g*/1/*h*/; //// } //// /*i*/b/*j*/: /*k*/number/*l*/ = /*m*/1/*n*/ +//// /*o*/public /*p*/ c: number = 1; /*q*/ +//// /*r*/d = 1 +//// /*s*/public e/*t*/ = /*u*/ 1 +//// f = 1/*v*/ /*w*/ +//// g = 1/*x*/ //// }; goTo.select("a", "b"); -verify.refactorAvailable("Generate 'get' and 'set' accessors"); +verify.not.refactorAvailable(); goTo.select("c", "d"); verify.refactorAvailable("Generate 'get' and 'set' accessors"); goTo.select("e", "f"); -verify.not.refactorAvailable("Generate 'get' and 'set' accessors"); +verify.not.refactorAvailable(); goTo.select("g", "h"); -verify.not.refactorAvailable("Generate 'get' and 'set' accessors"); +verify.not.refactorAvailable(); goTo.select("i", "j"); -verify.refactorAvailable("Generate 'get' and 'set' accessors"); +verify.not.refactorAvailable(); goTo.select("k", "l"); -verify.refactorAvailable("Generate 'get' and 'set' accessors"); +verify.not.refactorAvailable(); goTo.select("m", "n"); -verify.refactorAvailable("Generate 'get' and 'set' accessors"); \ No newline at end of file +verify.not.refactorAvailable(); + +goTo.select("o", "p"); +verify.not.refactorAvailable(); + +goTo.select("q", "r"); +verify.not.refactorAvailable(); + +goTo.select("s", "t"); +verify.refactorAvailable("Generate 'get' and 'set' accessors"); + +goTo.select("u", "v"); +verify.not.refactorAvailable(); + +goTo.select("w", "x"); +verify.refactorAvailable("Generate 'get' and 'set' accessors"); From dff19a5f706cc8b3514a23cf255ec38366959d0c Mon Sep 17 00:00:00 2001 From: bluelovers Date: Fri, 18 May 2018 10:07:46 +0800 Subject: [PATCH 27/30] es2018 regexp dotAll --- lib/lib.es2018.regexp.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/lib.es2018.regexp.d.ts b/lib/lib.es2018.regexp.d.ts index 0c3358ef6af..a0017f21438 100644 --- a/lib/lib.es2018.regexp.d.ts +++ b/lib/lib.es2018.regexp.d.ts @@ -28,4 +28,9 @@ interface RegExpExecArray { groups?: { [key: string]: string } -} \ No newline at end of file +} + +interface RegExp { + /** Returns a Boolean value indicating the state of the dotAll flag (s) used with a regular expression. Default is false. Read-only. */ + readonly dotAll: boolean; +} From 89059f0b8546771589104863018305b14a1c3078 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 18 May 2018 08:46:50 -0700 Subject: [PATCH 28/30] Some RWC tests had dupes in their input/outher files list because paths werent both resolved (#24235) --- src/harness/rwcRunner.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index ec620e6611b..d0fe3a04c1f 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -89,29 +89,29 @@ namespace RWC { const uniqueNames = ts.createMap(); for (const fileName of fileNames) { // Must maintain order, build result list while checking map - const normalized = ts.normalizeSlashes(fileName); + const normalized = ts.normalizeSlashes(Harness.IO.resolvePath(fileName)); if (!uniqueNames.has(normalized)) { uniqueNames.set(normalized, true); // Load the file - inputFiles.push(getHarnessCompilerInputUnit(fileName)); + inputFiles.push(getHarnessCompilerInputUnit(normalized)); } } // Add files to compilation for (const fileRead of ioLog.filesRead) { - const normalized = ts.normalizeSlashes(fileRead.path); - if (!uniqueNames.has(normalized) && !Harness.isDefaultLibraryFile(fileRead.path)) { - uniqueNames.set(normalized, true); - otherFiles.push(getHarnessCompilerInputUnit(fileRead.path)); + const unitName = ts.normalizeSlashes(Harness.IO.resolvePath(fileRead.path)); + if (!uniqueNames.has(unitName) && !Harness.isDefaultLibraryFile(fileRead.path)) { + uniqueNames.set(unitName, true); + otherFiles.push(getHarnessCompilerInputUnit(unitName)); } - else if (!opts.options.noLib && Harness.isDefaultLibraryFile(fileRead.path) && !uniqueNames.has(normalized) && useCustomLibraryFile) { + else if (!opts.options.noLib && Harness.isDefaultLibraryFile(fileRead.path) && !uniqueNames.has(unitName) && useCustomLibraryFile) { // If useCustomLibraryFile is true, we will use lib.d.ts from json object // otherwise use the lib.d.ts from built/local // Majority of RWC code will be using built/local/lib.d.ts instead of // lib.d.ts inside json file. However, some RWC cases will still use // their own version of lib.d.ts because they have customized lib.d.ts - uniqueNames.set(normalized, true); - inputFiles.push(getHarnessCompilerInputUnit(fileRead.path)); + uniqueNames.set(unitName, true); + inputFiles.push(getHarnessCompilerInputUnit(unitName)); } } }); From 76573c6520407c099e0c818113f091ab6e7dcdd1 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 18 May 2018 10:17:35 -0700 Subject: [PATCH 29/30] getEffectiveTypeParameterDeclarations: Always return a defined result (#24251) --- src/compiler/checker.ts | 35 +++++++++---------- src/compiler/utilities.ts | 17 ++++----- .../codefixes/annotateWithTypeFromJSDoc.ts | 2 +- src/services/codefixes/fixUnusedIdentifier.ts | 5 +-- src/services/refactors/extractSymbol.ts | 16 ++------- 5 files changed, 29 insertions(+), 46 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3e3c3964b94..2650e50a04e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5165,7 +5165,7 @@ namespace ts { // Appends the type parameters given by a list of declarations to a set of type parameters and returns the resulting set. // The function allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set // in-place and returns the same array. - function appendTypeParameters(typeParameters: TypeParameter[], declarations: ReadonlyArray): TypeParameter[] { + function appendTypeParameters(typeParameters: TypeParameter[] | undefined, declarations: ReadonlyArray): TypeParameter[] { for (const declaration of declarations) { typeParameters = appendIfUnique(typeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration))); } @@ -5206,7 +5206,7 @@ namespace ts { else if (node.kind === SyntaxKind.ConditionalType) { return concatenate(outerTypeParameters, getInferTypeParameters(node)); } - const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node) || emptyArray); + const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node)); const thisType = includeThisTypes && (node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression || node.kind === SyntaxKind.InterfaceDeclaration) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; @@ -5224,17 +5224,14 @@ namespace ts { // The local type parameters are the combined set of type parameters from all declarations of the class, // interface, or type alias. function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol: Symbol): TypeParameter[] { - let result: TypeParameter[]; + let result: TypeParameter[] | undefined; for (const node of symbol.declarations) { if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression || isTypeAlias(node)) { const declaration = node; - const typeParameters = getEffectiveTypeParameterDeclarations(declaration); - if (typeParameters) { - result = appendTypeParameters(result, typeParameters); - } + result = appendTypeParameters(result, getEffectiveTypeParameterDeclarations(declaration)); } } return result; @@ -5744,7 +5741,7 @@ namespace ts { const typeParameters = getEffectiveTypeParameterDeclarations(node); return (node.kind === SyntaxKind.Constructor || (returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && - (!typeParameters || typeParameters.every(isThislessTypeParameter)); + typeParameters.every(isThislessTypeParameter); } /** @@ -7071,11 +7068,11 @@ namespace ts { // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual // type checking functions). - function getTypeParametersFromDeclaration(declaration: DeclarationWithTypeParameters): TypeParameter[] { - let result: TypeParameter[]; - forEach(getEffectiveTypeParameterDeclarations(declaration), node => { + function getTypeParametersFromDeclaration(declaration: DeclarationWithTypeParameters): TypeParameter[] | undefined { + let result: TypeParameter[] | undefined; + for (const node of getEffectiveTypeParameterDeclarations(declaration)) { result = appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol)); - }); + } return result; } @@ -22679,7 +22676,7 @@ namespace ts { // Only report errors on the last declaration for the type parameter container; // this ensures that all uses have been accounted for. const typeParameters = getEffectiveTypeParameterDeclarations(node); - if (!(node.flags & NodeFlags.Ambient) && typeParameters && last(getSymbolOfNode(node)!.declarations) === node) { + if (!(node.flags & NodeFlags.Ambient) && last(getSymbolOfNode(node)!.declarations) === node) { for (const typeParameter of typeParameters) { if (!(getMergedSymbol(typeParameter.symbol).isReferenced & SymbolFlags.TypeParameter) && !isIdentifierThatStartsWithUnderScore(typeParameter.name)) { addDiagnostic(UnusedKind.Parameter, createDiagnosticForNode(typeParameter.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(typeParameter.symbol))); @@ -24047,7 +24044,7 @@ namespace ts { /** * Check each type parameter and check that type parameters have no duplicate type parameter declarations */ - function checkTypeParameters(typeParameterDeclarations: ReadonlyArray) { + function checkTypeParameters(typeParameterDeclarations: ReadonlyArray | undefined) { if (typeParameterDeclarations) { let seenDefault = false; for (let i = 0; i < typeParameterDeclarations.length; i++) { @@ -24103,7 +24100,7 @@ namespace ts { for (const declaration of declarations) { // If this declaration has too few or too many type parameters, we report an error const sourceParameters = getEffectiveTypeParameterDeclarations(declaration); - const numTypeParameters = length(sourceParameters); + const numTypeParameters = sourceParameters.length; if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { return false; } @@ -27371,7 +27368,7 @@ namespace ts { } } - function checkGrammarTypeParameterList(typeParameters: NodeArray, file: SourceFile): boolean { + function checkGrammarTypeParameterList(typeParameters: NodeArray | undefined, file: SourceFile): boolean { if (typeParameters && typeParameters.length === 0) { const start = typeParameters.pos - "<".length; const end = skipTrivia(file.text, typeParameters.end) + ">".length; @@ -27427,7 +27424,7 @@ namespace ts { function checkGrammarClassLikeDeclaration(node: ClassLikeDeclaration): boolean { const file = getSourceFileOfNode(node); - return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(getEffectiveTypeParameterDeclarations(node), file); + return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file); } function checkGrammarArrowFunction(node: Node, file: SourceFile): boolean { @@ -28199,8 +28196,8 @@ namespace ts { function checkGrammarConstructorTypeParameters(node: ConstructorDeclaration) { const typeParameters = getEffectiveTypeParameterDeclarations(node); - if (typeParameters) { - const { pos, end } = isNodeArray(typeParameters) ? typeParameters : first(typeParameters); + if (isNodeArray(typeParameters)) { + const { pos, end } = typeParameters; return grammarErrorAtPos(node, pos, end - pos, Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8fab560850d..fa6f65640da 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3101,9 +3101,9 @@ namespace ts { * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. */ - export function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters) { + export function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray { if (isJSDocSignature(node)) { - return undefined; + return emptyArray; } if (isJSDocTypeAlias(node)) { Debug.assert(node.parent.kind === SyntaxKind.JSDocComment); @@ -3114,17 +3114,14 @@ namespace ts { templateTagNodes.hasTrailingComma = false; return templateTagNodes; } - return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined); + return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : emptyArray); } - export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters) { + export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray { const tags = filter(getJSDocTags(node), isJSDocTemplateTag); - for (const tag of tags) { - if (!(tag.parent.kind === SyntaxKind.JSDocComment && find(tag.parent.tags, isJSDocTypeAlias))) { - // template tags are only available when a typedef isn't already using them - return tag.typeParameters; - } - } + // template tags are only available when a typedef isn't already using them + const tag = find(tags, tag => !(tag.parent.kind === SyntaxKind.JSDocComment && find(tag.parent.tags, isJSDocTypeAlias))); + return (tag && tag.typeParameters) || emptyArray; } /** diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts index 5b809452677..7b664678436 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -43,7 +43,7 @@ namespace ts.codefix { if (isFunctionLikeDeclaration(decl) && (getJSDocReturnType(decl) || decl.parameters.some(p => !!getJSDocType(p)))) { if (!decl.typeParameters) { const typeParameters = getJSDocTypeParameterDeclarations(decl); - if (typeParameters) changes.insertTypeParameters(sourceFile, decl, typeParameters); + if (typeParameters.length) changes.insertTypeParameters(sourceFile, decl, typeParameters); } const needParens = isArrowFunction(decl) && !findChildOfKind(decl, SyntaxKind.OpenParenToken, sourceFile); if (needParens) changes.insertNodeBefore(sourceFile, first(decl.parameters), createToken(SyntaxKind.OpenParenToken)); diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index e15407b625b..f22a87f102e 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -166,8 +166,9 @@ namespace ts.codefix { case SyntaxKind.TypeParameter: const typeParameters = getEffectiveTypeParameterDeclarations(parent.parent); if (typeParameters.length === 1) { - const previousToken = getTokenAtPosition(sourceFile, typeParameters.pos - 1, /*includeJsDocComment*/ false); - const nextToken = getTokenAtPosition(sourceFile, typeParameters.end, /*includeJsDocComment*/ false); + const { pos, end } = cast(typeParameters, isNodeArray); + const previousToken = getTokenAtPosition(sourceFile, pos - 1, /*includeJsDocComment*/ false); + const nextToken = getTokenAtPosition(sourceFile, end, /*includeJsDocComment*/ false); Debug.assert(previousToken.kind === SyntaxKind.LessThanToken); Debug.assert(nextToken.kind === SyntaxKind.GreaterThanToken); diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 4c5d7ff6f09..32a39c8f9ad 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1464,7 +1464,7 @@ namespace ts.refactor.extractSymbol { } // Note that we add the current node's type parameters *after* updating the corresponding scope. - if (isDeclarationWithTypeParameters(curr) && getEffectiveTypeParameterDeclarations(curr)) { + if (isDeclarationWithTypeParameters(curr)) { for (const typeParameterDecl of getEffectiveTypeParameterDeclarations(curr)) { const typeParameter = checker.getTypeAtLocation(typeParameterDecl) as TypeParameter; if (allTypeParameterUsages.has(typeParameter.id.toString())) { @@ -1534,20 +1534,8 @@ namespace ts.refactor.extractSymbol { return { target, usagesPerScope, functionErrorsPerScope, constantErrorsPerScope, exposedVariableDeclarations }; - function hasTypeParameters(node: Node) { - return isDeclarationWithTypeParameters(node) && - getEffectiveTypeParameterDeclarations(node) && - getEffectiveTypeParameterDeclarations(node).length > 0; - } - function isInGenericContext(node: Node) { - for (; node; node = node.parent) { - if (hasTypeParameters(node)) { - return true; - } - } - - return false; + return !!findAncestor(node, n => isDeclarationWithTypeParameters(n) && getEffectiveTypeParameterDeclarations(n).length !== 0); } function recordTypeParameterUsages(type: Type) { From 9e195676384b0fc1da257b4eb643e3cdcf3776a6 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Fri, 18 May 2018 11:23:27 -0700 Subject: [PATCH 30/30] Update user baselines (#24247) --- .../user/chrome-devtools-frontend.log | 100 +++++++++--------- .../reference/user/enhanced-resolve.log | 2 +- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index 7f09fcb11d2..dc54ce92c73 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -582,9 +582,9 @@ node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(509,90): node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(511,32): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(511,58): error TS2339: Property 'message' does not exist on type 'any[]'. node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(514,49): error TS2339: Property 'progressBarClass' does not exist on type 'any[]'. -node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(523,5): error TS2322: Type '{ [x: string]: any; progressBarClass: string; message: string; statusMessagePrefix: string; order...' is not assignable to type 'any[]'. node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(523,5): error TS2322: Type '{ [x: string]: any; progressBarClass: string; message: string; statusMessagePrefix: string; order...' is not assignable to type 'any[]'. Property 'flatMap' is missing in type '{ [x: string]: any; progressBarClass: string; message: string; statusMessagePrefix: string; order...'. +node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(523,5): error TS2322: Type '{ [x: string]: any; progressBarClass: string; message: string; statusMessagePrefix: string; order...' is not assignable to type 'any[]'. node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(553,32): error TS2345: Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string | string[]'. Type 'TemplateStringsArray' is not assignable to type 'string[]'. node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(594,38): error TS2555: Expected at least 2 arguments, but got 1. @@ -4730,10 +4730,10 @@ node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(175,64 node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(190,48): error TS2694: Namespace 'Coverage' has no exported member 'RangeUseCount'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(191,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'entry' must be of type '[CSSStyleSheetHeader, any[]]', but here has type 'CoverageInfo'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(193,28): error TS2339: Property 'CoverageType' does not exist on type 'typeof Coverage'. -node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(197,5): error TS2322: Type '[CSSStyleSheetHeader, any[]][]' is not assignable to type 'CoverageInfo[]'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(197,5): error TS2322: Type '[CSSStyleSheetHeader, any[]][]' is not assignable to type 'CoverageInfo[]'. Type '[CSSStyleSheetHeader, any[]]' is not assignable to type 'CoverageInfo'. Property '_contentProvider' is missing in type '[CSSStyleSheetHeader, any[]]'. +node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(197,5): error TS2322: Type '[CSSStyleSheetHeader, any[]][]' is not assignable to type 'CoverageInfo[]'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(201,31): error TS2694: Namespace 'Coverage' has no exported member 'RangeUseCount'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(202,32): error TS2694: Namespace 'Coverage' has no exported member 'CoverageSegment'. node_modules/chrome-devtools-frontend/front_end/coverage/CoverageModel.js(210,23): error TS2339: Property 'peekLast' does not exist on type 'any[]'. @@ -4854,8 +4854,8 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(474,27): e node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(591,44): error TS2345: Argument of type 'NODE_TYPE' is not assignable to parameter of type 'DataGridNode'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(595,25): error TS2339: Property 'data' does not exist on type 'NODE_TYPE'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(622,5): error TS2322: Type 'DataGridNode[]' is not assignable to type 'NODE_TYPE[]'. - Type 'DataGridNode' is not assignable to type 'NODE_TYPE'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(622,5): error TS2322: Type 'DataGridNode[]' is not assignable to type 'NODE_TYPE[]'. + Type 'DataGridNode' is not assignable to type 'NODE_TYPE'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(641,56): error TS2339: Property 'offsetWidth' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(648,37): error TS2339: Property 'offsetWidth' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(649,41): error TS2339: Property 'rows' does not exist on type 'Element'. @@ -5037,10 +5037,10 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(2008,1): e node_modules/chrome-devtools-frontend/front_end/data_grid/ShowMoreDataGridNode.js(109,14): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(9,1): error TS8022: JSDoc '@extends' is not attached to a class. node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(11,40): error TS2694: Namespace 'DataGrid' has no exported member 'ColumnDescriptor'. -node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(19,5): error TS2322: Type '(a: SortableDataGridNode, b: SortableDataGridNode) => number' is not assignable to type '(arg0: NODE_TYPE, arg1: NODE_TYPE) => number'. node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(19,5): error TS2322: Type '(a: SortableDataGridNode, b: SortableDataGridNode) => number' is not assignable to type '(arg0: NODE_TYPE, arg1: NODE_TYPE) => number'. Types of parameters 'a' and 'arg0' are incompatible. Type 'NODE_TYPE' is not assignable to type 'SortableDataGridNode'. +node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(19,5): error TS2322: Type '(a: SortableDataGridNode, b: SortableDataGridNode) => number' is not assignable to type '(arg0: NODE_TYPE, arg1: NODE_TYPE) => number'. node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(20,80): error TS2345: Argument of type 'SortableDataGridNode' is not assignable to parameter of type 'NODE_TYPE'. node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(82,56): error TS2694: Namespace 'DataGrid' has no exported member 'ColumnDescriptor'. node_modules/chrome-devtools-frontend/front_end/data_grid/SortableDataGrid.js(131,20): error TS2352: Type 'NODE_TYPE' cannot be converted to type 'SortableDataGridNode'. @@ -5075,10 +5075,10 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(25 node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(257,47): error TS2339: Property 'offsetHeight' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(272,1): error TS8022: JSDoc '@extends' is not attached to a class. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(320,22): error TS2352: Type 'NODE_TYPE' cannot be converted to type 'ViewportDataGridNode'. -node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(334,9): error TS2322: Type 'NODE_TYPE[][]' is not assignable to type 'ViewportDataGridNode[][]'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(334,9): error TS2322: Type 'NODE_TYPE[][]' is not assignable to type 'ViewportDataGridNode[][]'. Type 'NODE_TYPE[]' is not assignable to type 'ViewportDataGridNode[]'. Type 'NODE_TYPE' is not assignable to type 'ViewportDataGridNode'. +node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(334,9): error TS2322: Type 'NODE_TYPE[][]' is not assignable to type 'ViewportDataGridNode[][]'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(363,15): error TS2339: Property 'parent' does not exist on type 'NODE_TYPE'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(372,11): error TS2339: Property 'remove' does not exist on type 'NODE_TYPE'. node_modules/chrome-devtools-frontend/front_end/data_grid/ViewportDataGrid.js(373,11): error TS2339: Property 'parent' does not exist on type 'NODE_TYPE'. @@ -5582,9 +5582,9 @@ node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget. node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget.js(109,26): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget.js(124,5): error TS2322: Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarToggle'. node_modules/chrome-devtools-frontend/front_end/elements/ElementStatePaneWidget.js(124,5): error TS2322: Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarToggle'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsBreadcrumbs.js(12,46): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsBreadcrumbs.js(86,37): error TS2339: Property 'nextSiblingElement' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/elements/ElementsBreadcrumbs.js(104,16): error TS2555: Expected at least 2 arguments, but got 1. @@ -6195,8 +6195,8 @@ node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(169,22) node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(174,57): error TS2339: Property 'window' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(181,27): error TS2339: Property 'setInspectedPageBounds' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type 'AdvancedApp' is not assignable to type '{ [x: string]: any; presentUI(document: Document): void; }'. - Property '_rootSplitWidget' does not exist on type '{ [x: string]: any; presentUI(document: Document): void; }'. node_modules/chrome-devtools-frontend/front_end/emulation/AdvancedApp.js(199,5): error TS2322: Type 'AdvancedApp' is not assignable to type '{ [x: string]: any; presentUI(document: Document): void; }'. + Property '_rootSplitWidget' does not exist on type '{ [x: string]: any; presentUI(document: Document): void; }'. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(9,1): error TS8022: JSDoc '@extends' is not attached to a class. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(50,81): error TS2345: Argument of type 'symbol' is not assignable to parameter of type '{ [x: string]: any; Global: symbol; Local: symbol; Session: symbol; }'. node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeModel.js(52,43): error TS2694: Namespace 'DeviceModeModel' has no exported member 'Type'. @@ -7703,9 +7703,9 @@ node_modules/chrome-devtools-frontend/front_end/main/Main.js(201,14): error TS25 node_modules/chrome-devtools-frontend/front_end/main/Main.js(202,14): error TS2551: Property 'resourceMapping' does not exist on type 'typeof Bindings'. Did you mean 'ResourceMapping'? node_modules/chrome-devtools-frontend/front_end/main/Main.js(204,5): error TS2322: Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. - Property '_workspace' does not exist on type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(204,5): error TS2322: Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. Type 'CSSWorkspaceBinding' is not assignable to type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. + Property '_workspace' does not exist on type '{ [x: string]: any; rawLocationToUILocation(rawLocation: CSSLocation): UILocation; uiLocationToRa...'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(208,5): error TS2322: Type 'ExtensionServer' is not assignable to type 'typeof extensionServer'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(208,5): error TS2322: Type 'ExtensionServer' is not assignable to type 'typeof extensionServer'. Property '_extensionAPITestHook' is missing in type 'ExtensionServer'. @@ -7745,9 +7745,9 @@ node_modules/chrome-devtools-frontend/front_end/main/Main.js(567,65): error TS23 node_modules/chrome-devtools-frontend/front_end/main/Main.js(591,25): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/main/Main.js(599,5): error TS2322: Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarMenuButton'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(599,5): error TS2322: Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarMenuButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarMenuButton'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(608,42): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/main/Main.js(609,34): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/main/Main.js(616,41): error TS2555: Expected at least 2 arguments, but got 1. @@ -7947,9 +7947,9 @@ node_modules/chrome-devtools-frontend/front_end/network/BlockedURLsPane.js(26,37 node_modules/chrome-devtools-frontend/front_end/network/BlockedURLsPane.js(28,51): error TS2694: Namespace 'NetworkManager' has no exported member 'BlockedPattern'. node_modules/chrome-devtools-frontend/front_end/network/BlockedURLsPane.js(29,5): error TS2322: Type 'ListWidget' is not assignable to type '{ [x: string]: any; renderItem(item: T, editable: boolean): Element; removeItemRequested(item: T,...'. Type 'ListWidget' is not assignable to type '{ [x: string]: any; renderItem(item: T, editable: boolean): Element; removeItemRequested(item: T,...'. + Property 'renderItem' is missing in type 'ListWidget'. node_modules/chrome-devtools-frontend/front_end/network/BlockedURLsPane.js(29,5): error TS2322: Type 'ListWidget' is not assignable to type '{ [x: string]: any; renderItem(item: T, editable: boolean): Element; removeItemRequested(item: T,...'. Type 'ListWidget' is not assignable to type '{ [x: string]: any; renderItem(item: T, editable: boolean): Element; removeItemRequested(item: T,...'. - Property 'renderItem' is missing in type 'ListWidget'. node_modules/chrome-devtools-frontend/front_end/network/BlockedURLsPane.js(35,58): error TS2694: Namespace 'NetworkManager' has no exported member 'BlockedPattern'. node_modules/chrome-devtools-frontend/front_end/network/BlockedURLsPane.js(52,39): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/BlockedURLsPane.js(53,47): error TS2555: Expected at least 2 arguments, but got 1. @@ -8354,9 +8354,9 @@ node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(219,7): error TS2322: Type 'Promise' is not assignable to type 'Promise'. node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(243,27): error TS2339: Property 'secondsToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(247,30): error TS2339: Property 'secondsToString' does not exist on type 'NumberConstructor'. -node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(252,7): error TS2322: Type '{ left: any; right: string; }' is not assignable to type '{ left: string; right: string; tooltip: string; }'. node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(252,7): error TS2322: Type '{ left: any; right: string; }' is not assignable to type '{ left: string; right: string; tooltip: string; }'. Property 'tooltip' is missing in type '{ left: any; right: string; }'. +node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(252,7): error TS2322: Type '{ left: any; right: string; }' is not assignable to type '{ left: string; right: string; tooltip: string; }'. node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(255,26): error TS2339: Property 'secondsToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(358,19): error TS2339: Property 'secondsToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/network/NetworkTimeCalculator.js(395,19): error TS2339: Property 'secondsToString' does not exist on type 'NumberConstructor'. @@ -8572,8 +8572,8 @@ node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameVi node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(250,14): error TS2339: Property 'createTextChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(251,14): error TS2339: Property 'title' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(292,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. - Property '_contentURL' does not exist on type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. node_modules/chrome-devtools-frontend/front_end/network/ResourceWebSocketFrameView.js(292,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. + Property '_contentURL' does not exist on type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(130,29): error TS2339: Property 'localizedFailDescription' does not exist on type 'NetworkRequest'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(150,36): error TS2694: Namespace 'HAREntry' has no exported member 'Timing'. node_modules/chrome-devtools-frontend/front_end/network_log/HAREntry.js(318,4): error TS1003: Identifier expected. @@ -9290,9 +9290,9 @@ node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductReg node_modules/chrome-devtools-frontend/front_end/product_registry_impl/ProductRegistryImpl.js(103,67): error TS2694: Namespace 'Registry' has no exported member 'ProductEntry'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(68,9): error TS2322: Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. - Property 'formatValue' is missing in type 'BottomUpProfileDataGridNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(68,9): error TS2322: Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. Type 'BottomUpProfileDataGridNode' is not assignable to type '{ [x: string]: any; formatValue(value: number, node: any & any): string; formatPercent(value: num...'. + Property 'formatValue' is missing in type 'BottomUpProfileDataGridNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(196,26): error TS2339: Property 'UID' does not exist on type 'ProfileNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(197,23): error TS2339: Property 'UID' does not exist on type 'ProfileNode'. node_modules/chrome-devtools-frontend/front_end/profiler/BottomUpProfileDataGrid.js(212,68): error TS2339: Property 'UID' does not exist on type 'ProfileNode'. @@ -9316,9 +9316,9 @@ node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileFlameChart.js node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileFlameChart.js(481,40): error TS2339: Property 'window' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(61,16): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(63,16): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(73,5): error TS2322: Type 'CPUFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(73,5): error TS2322: Type 'CPUFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. Property '_cpuProfile' does not exist on type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. +node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(73,5): error TS2322: Type 'CPUFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(82,43): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(85,29): error TS2339: Property 'instance' does not exist on type 'typeof CPUProfileType'. node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(115,30): error TS2555: Expected at least 2 arguments, but got 1. @@ -9347,9 +9347,9 @@ node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(405,7 node_modules/chrome-devtools-frontend/front_end/profiler/CPUProfileView.js(407,24): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(31,16): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(33,16): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(43,5): error TS2322: Type 'HeapFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(43,5): error TS2322: Type 'HeapFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. Property '_profile' does not exist on type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. +node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(43,5): error TS2322: Type 'HeapFlameChartDataProvider' is not assignable to type '{ [x: string]: any; minimumBoundary(): number; totalTime(): number; formatValue(value: number, pr...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(52,52): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(54,38): error TS2339: Property 'instance' does not exist on type 'typeof SamplingHeapProfileType'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfileView.js(82,30): error TS2555: Expected at least 2 arguments, but got 1. @@ -9384,10 +9384,10 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapProfilerPanel.js(10 node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(34,41): error TS2417: Class static side 'typeof HeapSnapshotSortableDataGrid' incorrectly extends base class static side 'typeof DataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }' is not assignable to type '{ [x: string]: any; SelectedNode: symbol; DeselectedNode: symbol; OpenedNode: symbol; SortingChan...'. + Property 'SelectedNode' is missing in type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(34,41): error TS2417: Class static side 'typeof HeapSnapshotSortableDataGrid' incorrectly extends base class static side 'typeof DataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }' is not assignable to type '{ [x: string]: any; SelectedNode: symbol; DeselectedNode: symbol; OpenedNode: symbol; SortingChan...'. - Property 'SelectedNode' is missing in type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(37,41): error TS2694: Namespace 'DataGrid' has no exported member 'ColumnDescriptor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(124,27): error TS2339: Property 'enclosingNodeOrSelfWithNodeName' does not exist on type 'EventTarget'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(137,46): error TS2555: Expected at least 2 arguments, but got 1. @@ -9418,10 +9418,10 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(603,43): error TS2417: Class static side 'typeof HeapSnapshotRetainmentDataGrid' incorrectly extends base class static side 'typeof HeapSnapshotContainmentDataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ExpandRetainersComplete: symbol; }' is not assignable to type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }'. + Property 'ContentShown' is missing in type '{ [x: string]: any; ExpandRetainersComplete: symbol; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(603,43): error TS2417: Class static side 'typeof HeapSnapshotRetainmentDataGrid' incorrectly extends base class static side 'typeof HeapSnapshotContainmentDataGrid'. Types of property 'Events' are incompatible. Type '{ [x: string]: any; ExpandRetainersComplete: symbol; }' is not assignable to type '{ [x: string]: any; ContentShown: symbol; SortingComplete: symbol; }'. - Property 'ContentShown' is missing in type '{ [x: string]: any; ExpandRetainersComplete: symbol; }'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(608,56): error TS2694: Namespace 'DataGrid' has no exported member 'ColumnDescriptor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(609,29): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotDataGrids.js(611,16): error TS2555: Expected at least 2 arguments, but got 1. @@ -9464,10 +9464,10 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(137,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(155,48): error TS2339: Property 'baseSystemDistance' does not exist on type 'typeof HeapSnapshotModel'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(156,95): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(163,5): error TS2322: Type '({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...' is not assignable to type 'DataGridNode[]'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(163,5): error TS2322: Type '({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...' is not assignable to type 'DataGridNode[]'. Type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...' is not assignable to type 'DataGridNode'. Property '_element' is missing in type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. +node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(163,5): error TS2322: Type '({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...' is not assignable to type 'DataGridNode[]'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(170,39): error TS2345: Argument of type 'this' is not assignable to parameter of type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Type 'HeapSnapshotGridNode' is not assignable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Type 'HeapSnapshotGridNode' is not assignable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. @@ -9499,12 +9499,12 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(580,12): error TS2339: Property 'style' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(581,10): error TS2339: Property 'heapSnapshotNode' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(602,75): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(682,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotObjectNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. - Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Property '_worker' does not exist on type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. +node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(682,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotObjectNode' is not assignable to the same property in base type 'HeapSnapshotGenericObjectNode'. + Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(980,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotConstructorNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. Type '() => HeapSnapshotProviderProxy' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(981,27): error TS2339: Property 'snapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1000,20): error TS2352: Type 'DataGridNode' cannot be converted to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Type 'DataGridNode' is not comparable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Property 'dispose' is missing in type 'DataGridNode'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1001,5): error TS2322: Type '(this | ({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1001,5): error TS2322: Type '(this | ({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...'. Type 'this | ({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Type 'this' is not assignable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. @@ -9533,6 +9532,7 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j Type 'this' is not assignable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Type 'HeapSnapshotConstructorNode' is not assignable to type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Property 'nodePosition' is missing in type 'HeapSnapshotConstructorNode'. +node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1001,5): error TS2322: Type '(this | ({ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; is...'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1019,14): error TS2339: Property '_searchMatched' does not exist on type 'HeapSnapshotConstructorNode'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1029,81): error TS2339: Property 'snapshot' does not exist on type 'HeapSnapshotSortableDataGrid'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1140,22): error TS2339: Property 'pushAll' does not exist on type 'any[]'. @@ -9542,12 +9542,12 @@ node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.j node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1181,27): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1182,29): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1183,65): error TS2339: Property 'withThousandsSeparator' does not exist on type 'NumberConstructor'. -node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1191,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotDiffNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. - Type '() => HeapSnapshotDiffNodesProvider' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise HeapSnapshotDiffNodesProvider' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. Property '_addedNodesProvider' does not exist on type '{ [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise; isE...'. +node_modules/chrome-devtools-frontend/front_end/profiler/HeapSnapshotGridNodes.js(1191,3): error TS2416: Property 'createProvider' in type 'HeapSnapshotDiffNode' is not assignable to the same property in base type 'HeapSnapshotGridNode'. + Type '() => HeapSnapshotDiffNodesProvider' is not assignable to type '() => { [x: string]: any; dispose(): void; nodePosition(snapshotObjectId: number): Promise any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. +node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(45,5): error TS2322: Type 'LocalJSONObject' is not assignable to type 'RemoteObject'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(73,42): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(73,73): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(87,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. @@ -11280,9 +11280,9 @@ node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(718,33): err node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(728,32): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(731,3): error TS2416: Property 'callFunctionJSON' in type 'RemoteObjectImpl' is not assignable to the same property in base type 'RemoteObject'. Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. + Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(731,3): error TS2416: Property 'callFunctionJSON' in type 'RemoteObjectImpl' is not assignable to the same property in base type 'RemoteObject'. Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. - Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(741,52): error TS2339: Property 'Error' does not exist on type 'typeof Protocol'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(795,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RemoteObject.js(797,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. @@ -11366,17 +11366,17 @@ node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(96,39): erro node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(125,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(133,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(168,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. -node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(173,5): error TS2322: Type 'RemoteObjectImpl' is not assignable to type 'RemoteObject'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(173,5): error TS2322: Type 'RemoteObjectImpl' is not assignable to type 'RemoteObject'. Types of property 'callFunctionJSON' are incompatible. Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. +node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(173,5): error TS2322: Type 'RemoteObjectImpl' is not assignable to type 'RemoteObject'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(179,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. +node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(184,5): error TS2322: Type 'ScopeRemoteObject' is not assignable to type 'RemoteObject'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(184,5): error TS2322: Type 'ScopeRemoteObject' is not assignable to type 'RemoteObject'. Types of property 'callFunctionJSON' are incompatible. Type '(functionDeclaration: (this: any) => any, args: any[], callback: (arg0: any) => any) => void' is not assignable to type '(functionDeclaration: (this: any, ...arg1: any[]) => T, args: any[], callback: (arg0: T) => an...'. Types of parameters 'functionDeclaration' and 'functionDeclaration' are incompatible. -node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(184,5): error TS2322: Type 'ScopeRemoteObject' is not assignable to type 'RemoteObject'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(199,40): error TS2339: Property 'Runtime' does not exist on type 'typeof Protocol'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(201,40): error TS2339: Property 'Runtime' does not exist on type 'typeof Protocol'. node_modules/chrome-devtools-frontend/front_end/sdk/RuntimeModel.js(203,40): error TS2339: Property 'Runtime' does not exist on type 'typeof Protocol'. @@ -11448,8 +11448,8 @@ node_modules/chrome-devtools-frontend/front_end/sdk/ScreenCaptureModel.js(160,24 node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(39,24): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(143,52): error TS2339: Property 'debuggerAgent' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(159,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. - Property '_contentURL' does not exist on type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(159,5): error TS2322: Type 'StaticContentProvider' is not assignable to type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. + Property '_contentURL' does not exist on type '{ [x: string]: any; contentURL(): string; contentType(): ResourceType; contentEncoded(): Promise<...'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(174,43): error TS2339: Property 'debuggerAgent' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(190,33): error TS2694: Namespace 'Protocol' has no exported member 'Error'. node_modules/chrome-devtools-frontend/front_end/sdk/Script.js(190,50): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'. @@ -11613,11 +11613,11 @@ node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(364,7): err Property '_socket' does not exist on type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(365,38): error TS2339: Property 'isHostedMode' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(366,7): error TS2322: Type 'StubConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. + Property '_onMessage' does not exist on type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(366,7): error TS2322: Type 'StubConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. - Property '_onMessage' does not exist on type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. -node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(368,7): error TS2322: Type 'MainConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(368,7): error TS2322: Type 'MainConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. Property '_onMessage' does not exist on type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. +node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(368,7): error TS2322: Type 'MainConnection' is not assignable to type '{ [x: string]: any; sendMessage(message: string): void; disconnect(): Promise; }'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(401,38): error TS2339: Property 'targetAgent' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(406,18): error TS2339: Property 'registerTargetDispatcher' does not exist on type 'Target'. node_modules/chrome-devtools-frontend/front_end/sdk/TargetManager.js(414,31): error TS2339: Property 'setDevicesUpdatesEnabled' does not exist on type 'typeof InspectorFrontendHost'. @@ -11938,9 +11938,9 @@ node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(324,3 node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(336,31): error TS2339: Property 'bringToFront' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/settings/SettingsScreen.js(351,31): error TS2339: Property 'bringToFront' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(70,35): error TS2339: Property 'remove' does not exist on type 'Map'. -node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(113,5): error TS2322: Type 'SnippetsProject' is not assignable to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(113,5): error TS2322: Type 'SnippetsProject' is not assignable to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. Property '_model' does not exist on type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. +node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(113,5): error TS2322: Type 'SnippetsProject' is not assignable to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(137,18): error TS2339: Property 'addEventListener' does not exist on type 'UISourceCode'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(146,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/snippets/ScriptSnippetModel.js(165,36): error TS2339: Property 'remove' does not exist on type 'Map'. @@ -12456,11 +12456,11 @@ node_modules/chrome-devtools-frontend/front_end/sources/NavigatorView.js(1614,14 node_modules/chrome-devtools-frontend/front_end/sources/NavigatorView.js(1616,40): error TS2339: Property '_treeElement' does not exist on type 'NavigatorTreeNode'. node_modules/chrome-devtools-frontend/front_end/sources/NavigatorView.js(1679,47): error TS2339: Property 'hasFocus' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/ObjectEventListenersSidebarPane.js(11,48): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/sources/ObjectEventListenersSidebarPane.js(24,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/sources/ObjectEventListenersSidebarPane.js(24,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. Property 'item' is missing in type 'ToolbarButton'. +node_modules/chrome-devtools-frontend/front_end/sources/ObjectEventListenersSidebarPane.js(24,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/sources/ObjectEventListenersSidebarPane.js(84,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/sources/OpenFileQuickOpen.js(23,34): error TS2345: Argument of type 'number' is not assignable to parameter of type '{ [x: string]: any; WindowDocked: number; WindowUndocked: number; ScriptsBreakpointSet: number; T...'. node_modules/chrome-devtools-frontend/front_end/sources/OutlineQuickOpen.js(32,52): error TS2694: Namespace 'FormatterWorkerPool' has no exported member 'OutlineItem'. @@ -12612,9 +12612,9 @@ node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(1078,60) node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(1093,22): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(1112,5): error TS2322: Type 'SourcesView' is not assignable to type '{ [x: string]: any; button(sourcesView: any & any): ToolbarButton; } & { [x: string]: any; button...'. Type 'SourcesView' is not assignable to type '{ [x: string]: any; button(sourcesView: any & any): ToolbarButton; }'. + Property 'button' is missing in type 'SourcesView'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(1112,5): error TS2322: Type 'SourcesView' is not assignable to type '{ [x: string]: any; button(sourcesView: any & any): ToolbarButton; } & { [x: string]: any; button...'. Type 'SourcesView' is not assignable to type '{ [x: string]: any; button(sourcesView: any & any): ToolbarButton; }'. - Property 'button' is missing in type 'SourcesView'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(1125,27): error TS2339: Property 'upgradeDraggedFileSystemPermissions' does not exist on type 'typeof InspectorFrontendHost'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(1290,38): error TS2339: Property '_instance' does not exist on type 'typeof WrapperView'. node_modules/chrome-devtools-frontend/front_end/sources/SourcesPanel.js(1298,47): error TS2339: Property '_instance' does not exist on type 'typeof WrapperView'. @@ -12746,11 +12746,11 @@ node_modules/chrome-devtools-frontend/front_end/sources/UISourceCodeFrame.js(761 node_modules/chrome-devtools-frontend/front_end/sources/UISourceCodeFrame.js(767,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(46,44): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(48,48): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(66,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(66,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarButton' is not assignable to type '{ [x: string]: any; item(): any & any; }'. Property 'item' is missing in type 'ToolbarButton'. +node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(66,5): error TS2322: Type 'ToolbarButton[]' is not assignable to type '({ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; })[]'. node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(97,25): error TS2339: Property 'removeChildren' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(99,46): error TS2339: Property 'createChild' does not exist on type 'Element'. node_modules/chrome-devtools-frontend/front_end/sources/WatchExpressionsSidebarPane.js(100,38): error TS2555: Expected at least 2 arguments, but got 1. @@ -13630,14 +13630,14 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(28,41 node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(43,14): error TS2339: Property '_reportErrorAndCancelLoading' does not exist on type 'typeof TimelineLoader'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(45,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. - Property 'loadingStarted' is missing in type 'TimelineLoader'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(45,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. -node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(56,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. - Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. + Property 'loadingStarted' is missing in type 'TimelineLoader'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(56,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. Property 'loadingStarted' is missing in type 'TimelineLoader'. +node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(56,5): error TS2322: Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. + Type 'TimelineLoader' is not assignable to type '{ [x: string]: any; loadingStarted(): void; loadingProgress(progress?: number): void; processingS...'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(91,43): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(118,41): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineLoader.js(137,54): error TS2694: Namespace 'TracingManager' has no exported member 'EventPayload'. @@ -13663,9 +13663,9 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelinePanel.js(206,42 Property 'item' is missing in type 'ToolbarSettingCheckbox'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelinePanel.js(207,5): error TS2322: Type 'ToolbarSettingCheckbox' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarSettingCheckbox' is not assignable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarSettingCheckbox'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelinePanel.js(207,5): error TS2322: Type 'ToolbarSettingCheckbox' is not assignable to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarSettingCheckbox' is not assignable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarSettingCheckbox'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelinePanel.js(212,42): error TS2345: Argument of type 'ToolbarToggle' is not assignable to parameter of type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not assignable to type '{ [x: string]: any; item(): any & any; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelinePanel.js(213,42): error TS2345: Argument of type 'ToolbarToggle' is not assignable to parameter of type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. @@ -13788,8 +13788,8 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(717 Property 'icon' is missing in type '{ name: string; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(717,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(727,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. - Property 'icon' is missing in type '{ name: string; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(727,9): error TS2322: Type '{ name: string; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. + Property 'icon' is missing in type '{ name: string; color: string; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(731,13): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(733,9): error TS2322: Type '{ name: any; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineTreeView.js(733,9): error TS2322: Type '{ name: any; color: string; }' is not assignable to type '{ name: string; color: string; icon: Element; }'. @@ -14135,9 +14135,9 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1652 node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1657,64): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'Node'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1664,11): error TS2555: Expected at least 2 arguments, but got 1. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1665,67): error TS2555: Expected at least 2 arguments, but got 1. -node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2322: Type 'DocumentFragment' is not assignable to type 'Element'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2322: Type 'DocumentFragment' is not assignable to type 'Element'. Property 'assignedSlot' is missing in type 'DocumentFragment'. +node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2322: Type 'DocumentFragment' is not assignable to type 'Element'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1684,30): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1685,16): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'. node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1687,13): error TS2339: Property 'createTextChild' does not exist on type 'Element'. @@ -14607,11 +14607,11 @@ node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(69,40): erro node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(80,24): error TS2694: Namespace 'Common' has no exported member 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(92,51): error TS2339: Property 'runtime' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(116,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. - Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(116,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. -node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(118,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(118,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. +node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(118,7): error TS2322: Type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }' is not assignable to type '{ [x: string]: any; appendApplicableItems(locationName: string): void; appendView(view: { [x: str...'. + Property 'appendApplicableItems' is missing in type '{ [x: string]: any; tabbedPane(): TabbedPane; enableMoreTabsButton(): void; }'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(247,73): error TS2339: Property 'altKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(247,89): error TS2339: Property 'shiftKey' does not exist on type 'Event'. node_modules/chrome-devtools-frontend/front_end/ui/InspectorView.js(254,17): error TS2339: Property 'keyCode' does not exist on type 'Event'. @@ -15066,9 +15066,9 @@ node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(343,36): error TS2 Type 'ToolbarSeparator' is not comparable to type '{ [x: string]: any; item(): any & any; }'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(346,17): error TS2352: Type 'ToolbarToggle' cannot be converted to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not comparable to type '{ [x: string]: any; item(): any & any; }'. + Property 'item' is missing in type 'ToolbarToggle'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(346,17): error TS2352: Type 'ToolbarToggle' cannot be converted to type '{ [x: string]: any; item(): any & any; } & { [x: string]: any; item(): any & any; }'. Type 'ToolbarToggle' is not comparable to type '{ [x: string]: any; item(): any & any; }'. - Property 'item' is missing in type 'ToolbarToggle'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(405,53): error TS2339: Property '_toolbar' does not exist on type 'ToolbarItem'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(405,70): error TS2339: Property '_toolbar' does not exist on type 'ToolbarItem'. node_modules/chrome-devtools-frontend/front_end/ui/Toolbar.js(412,18): error TS2339: Property 'disabled' does not exist on type 'Element'. @@ -15547,10 +15547,10 @@ node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(188,15): node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(199,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(204,15): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(229,25): error TS2694: Namespace 'Workspace' has no exported member 'projectTypes'. +node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(243,25): error TS2352: Type 'this' cannot be converted to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(243,25): error TS2352: Type 'this' cannot be converted to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. Type 'ProjectStore' is not comparable to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. Property 'isServiceProject' is missing in type 'ProjectStore'. -node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(243,25): error TS2352: Type 'this' cannot be converted to type '{ [x: string]: any; workspace(): Workspace; id(): string; type(): string; isServiceProject(): boo...'. node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(257,5): error TS2322: Type '{ [x: string]: any; Debugger: string; Formatter: string; Network: string; Snippets: string; FileS...' is not assignable to type 'string'. node_modules/chrome-devtools-frontend/front_end/workspace/Workspace.js(432,27): error TS2339: Property 'valuesArray' does not exist on type 'Map any'. node_modules/enhanced-resolve/lib/createInnerCallback.js(17,20): error TS2339: Property 'missing' does not exist on type '(...args: any[]) => any'. + Standard error: