From 426a63e8b6a98b2f6ff7eeddf98f0653582c744f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 15 May 2018 12:24:40 -0700 Subject: [PATCH 01/40] 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/40] 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/40] 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 027829fbcd0a84172ab4a36d60a0ac915ca7ea09 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 16 May 2018 16:26:37 -0700 Subject: [PATCH 04/40] 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 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 05/40] 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 176e35b9c3482e8bff4fbf25929b2cbbd58f4295 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 17 May 2018 09:54:47 -0700 Subject: [PATCH 06/40] 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 07/40] 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 08/40] 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 09/40] 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 10/40] 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 11/40] 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 12/40] 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 13/40] 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 14/40] 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 15/40] 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 16/40] 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 17/40] 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 18/40] 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 52e8c2d66313e9a8ef813219c93fdf98ee536330 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 17 May 2018 16:19:50 -0700 Subject: [PATCH 19/40] Unused variable error reporting needs to handle nodes that could not belong to current source file Eg. when resolving module, the another file gets checked and its locals are added to potentiallyUnused list Fixes #24215 --- src/compiler/checker.ts | 27 ++++++++-------- ...stionOfUnusedVariableWithExternalModule.ts | 31 +++++++++++++++++++ 2 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 tests/cases/fourslash/suggestionOfUnusedVariableWithExternalModule.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3e3c3964b94..c4d55404d4e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -319,7 +319,7 @@ namespace ts { checkSourceFile(file); const diagnostics: Diagnostic[] = []; Debug.assert(!!(getNodeLinks(file).flags & NodeCheckFlags.TypeChecked)); - checkUnusedIdentifiers(allPotentiallyUnusedIdentifiers.get(file.fileName)!, (kind, diag) => { + checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), (kind, diag) => { if (!unusedIsError(kind)) { diagnostics.push({ ...diag, category: DiagnosticCategory.Suggestion }); } @@ -450,9 +450,7 @@ namespace ts { let deferredGlobalExtractSymbol: Symbol; let deferredNodes: Node[]; - const allPotentiallyUnusedIdentifiers = createMap>(); // key is file name - let potentiallyUnusedIdentifiers: PotentiallyUnusedIdentifier[]; // Potentially unused identifiers in the source file currently being checked. - const seenPotentiallyUnusedIdentifiers = createMap(); // For assertion that we don't defer the same identifier twice + const allPotentiallyUnusedIdentifiers = createMap(); // key is file name let flowLoopStart = 0; let flowLoopCount = 0; @@ -22557,7 +22555,13 @@ namespace ts { function registerForUnusedIdentifiersCheck(node: PotentiallyUnusedIdentifier): void { // May be in a call such as getTypeOfNode that happened to call this. But potentiallyUnusedIdentifiers is only defined in the scope of `checkSourceFile`. - if (potentiallyUnusedIdentifiers) { + if (produceDiagnostics) { + const sourceFile = getSourceFileOfNode(node); + let potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path); + if (!potentiallyUnusedIdentifiers) { + potentiallyUnusedIdentifiers = []; + allPotentiallyUnusedIdentifiers.set(sourceFile.path, potentiallyUnusedIdentifiers); + } // TODO: GH#22580 // Debug.assert(addToSeen(seenPotentiallyUnusedIdentifiers, getNodeId(node)), "Adding potentially-unused identifier twice"); potentiallyUnusedIdentifiers.push(node); @@ -25539,6 +25543,10 @@ namespace ts { } } + function getPotentiallyUnusedIdentifiers(sourceFile: SourceFile): ReadonlyArray { + return allPotentiallyUnusedIdentifiers.get(sourceFile.path) || emptyArray; + } + // Fully type check a source file and collect the relevant diagnostics. function checkSourceFileWorker(node: SourceFile) { const links = getNodeLinks(node); @@ -25557,11 +25565,6 @@ namespace ts { clear(potentialNewTargetCollisions); deferredNodes = []; - if (produceDiagnostics) { - Debug.assert(!allPotentiallyUnusedIdentifiers.has(node.fileName)); - allPotentiallyUnusedIdentifiers.set(node.fileName, potentiallyUnusedIdentifiers = []); - } - forEach(node.statements, checkSourceElement); checkDeferredNodes(); @@ -25571,7 +25574,7 @@ namespace ts { } if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) { - checkUnusedIdentifiers(potentiallyUnusedIdentifiers, (kind, diag) => { + checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), (kind, diag) => { if (unusedIsError(kind)) { diagnostics.add(diag); } @@ -25579,8 +25582,6 @@ namespace ts { } deferredNodes = undefined; - seenPotentiallyUnusedIdentifiers.clear(); - potentiallyUnusedIdentifiers = undefined; if (isExternalOrCommonJsModule(node)) { checkExternalModuleExports(node); diff --git a/tests/cases/fourslash/suggestionOfUnusedVariableWithExternalModule.ts b/tests/cases/fourslash/suggestionOfUnusedVariableWithExternalModule.ts new file mode 100644 index 00000000000..b86f79a8e49 --- /dev/null +++ b/tests/cases/fourslash/suggestionOfUnusedVariableWithExternalModule.ts @@ -0,0 +1,31 @@ +/// + +//@allowJs: true + +// @Filename: /mymodule.js +////(function ([|root|], factory) { +//// module.exports = factory(); +////}(this, function () { +//// var [|unusedVar|] = "something"; +//// return {}; +////})); + +// @Filename: /app.js +//////@ts-check +////require("./mymodule"); + +const [range0, range1] = test.ranges(); + +goTo.file("/app.js"); +verify.getSuggestionDiagnostics([]); + +goTo.file("/mymodule.js"); +verify.getSuggestionDiagnostics([{ + message: "'root' is declared but its value is never read.", + code: 6133, + range: range0 +}, { + message: "'unusedVar' is declared but its value is never read.", + code: 6133, + range: range1 +}]); 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 20/40] 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 a3272416559c23c33cc908dc3b2e1cd60ef50f16 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Thu, 17 May 2018 15:32:42 -0700 Subject: [PATCH 21/40] Sort exports when organizeImports is run Note that there's no attempt to remove unused exports. Fixes #23640 --- src/harness/unittests/organizeImports.ts | 251 ++++++++++++++++++ src/services/organizeImports.ts | 92 ++++++- .../organizeImports/AmbientModule.exports.ts | 15 ++ .../CoalesceMultipleModules.exports.ts | 11 + .../organizeImports/CoalesceTrivia.exports.ts | 8 + .../organizeImports/MoveToTop.exports.ts | 13 + .../MoveToTop_Invalid.exports.ts | 20 ++ .../MoveToTop_WithExportsFirst.exports.ts | 23 ++ .../MoveToTop_WithImportsFirst.exports.ts | 23 ++ .../SortHeaderComment.exports.ts | 11 + .../organizeImports/SortTrivia.exports.ts | 9 + .../TopLevelAndAmbientModule.exports.ts | 23 ++ 12 files changed, 493 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/organizeImports/AmbientModule.exports.ts create mode 100644 tests/baselines/reference/organizeImports/CoalesceMultipleModules.exports.ts create mode 100644 tests/baselines/reference/organizeImports/CoalesceTrivia.exports.ts create mode 100644 tests/baselines/reference/organizeImports/MoveToTop.exports.ts create mode 100644 tests/baselines/reference/organizeImports/MoveToTop_Invalid.exports.ts create mode 100644 tests/baselines/reference/organizeImports/MoveToTop_WithExportsFirst.exports.ts create mode 100644 tests/baselines/reference/organizeImports/MoveToTop_WithImportsFirst.exports.ts create mode 100644 tests/baselines/reference/organizeImports/SortHeaderComment.exports.ts create mode 100644 tests/baselines/reference/organizeImports/SortTrivia.exports.ts create mode 100644 tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.exports.ts diff --git a/src/harness/unittests/organizeImports.ts b/src/harness/unittests/organizeImports.ts index d8f15ce66bd..ae544e4e0bd 100644 --- a/src/harness/unittests/organizeImports.ts +++ b/src/harness/unittests/organizeImports.ts @@ -181,6 +181,85 @@ namespace ts { }); }); + describe("Coalesce exports", () => { + it("No exports", () => { + assert.isEmpty(OrganizeImports.coalesceExports([])); + }); + + it("Sort specifiers", () => { + const sortedExports = parseExports(`export { default as m, a as n, b, y, z as o } from "lib";`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = parseExports(`export { a as n, b, default as m, y, z as o } from "lib";`); + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + + it("Sort specifiers - case-insensitive", () => { + const sortedExports = parseExports(`export { default as M, a as n, B, y, Z as O } from "lib";`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = parseExports(`export { a as n, B, default as M, y, Z as O } from "lib";`); + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + + it("Combine namespace re-exports", () => { + const sortedExports = parseExports( + `export * from "lib";`, + `export * from "lib";`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = parseExports(`export * from "lib";`); + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + + it("Combine property exports", () => { + const sortedExports = parseExports( + `export { x };`, + `export { y as z };`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = parseExports(`export { x, y as z };`); + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + + it("Combine property re-exports", () => { + const sortedExports = parseExports( + `export { x } from "lib";`, + `export { y as z } from "lib";`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = parseExports(`export { x, y as z } from "lib";`); + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + + it("Combine namespace re-export with property re-export", () => { + const sortedExports = parseExports( + `export * from "lib";`, + `export { y } from "lib";`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = sortedExports; + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + + it("Combine many exports", () => { + const sortedExports = parseExports( + `export { x };`, + `export { y as w, z as default };`, + `export { w as q };`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = parseExports( + `export { w as q, x, y as w, z as default };`); + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + + it("Combine many re-exports", () => { + const sortedExports = parseExports( + `export { x as a, y } from "lib";`, + `export * from "lib";`, + `export { z as b } from "lib";`); + const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); + const expectedCoalescedExports = parseExports( + `export * from "lib";`, + `export { x as a, y, z as b } from "lib";`); + assertListEqual(actualCoalescedExports, expectedCoalescedExports); + }); + }); + describe("Baselines", () => { const libFile = { @@ -471,6 +550,154 @@ import { React, Other } from "react"; }, reactLibFile); + describe("Exports", () => { + + testOrganizeExports("MoveToTop", + { + path: "/test.ts", + content: ` +export { F1, F2 } from "lib"; +1; +export * from "lib"; +2; +`, + }, + libFile); + + // tslint:disable no-invalid-template-strings + testOrganizeExports("MoveToTop_Invalid", + { + path: "/test.ts", + content: ` +export { F1, F2 } from "lib"; +1; +export * from "lib"; +2; +export { b } from ${"`${'lib'}`"}; +export { a } from ${"`${'lib'}`"}; +export { D } from "lib"; +3; +`, + }, + libFile); + // tslint:enable no-invalid-template-strings + + testOrganizeExports("MoveToTop_WithImportsFirst", + { + path: "/test.ts", + content: ` +import { F1, F2 } from "lib"; +1; +export { F1, F2 } from "lib"; +2; +import * as NS from "lib"; +3; +export * from "lib"; +4; +F1(); F2(); NS.F1(); +`, + }, + libFile); + + testOrganizeExports("MoveToTop_WithExportsFirst", + { + path: "/test.ts", + content: ` +export { F1, F2 } from "lib"; +1; +import { F1, F2 } from "lib"; +2; +export * from "lib"; +3; +import * as NS from "lib"; +4; +F1(); F2(); NS.F1(); +`, + }, + libFile); + + testOrganizeExports("CoalesceMultipleModules", + { + path: "/test.ts", + content: ` +export { d } from "lib1"; +export { b } from "lib1"; +export { c } from "lib2"; +export { a } from "lib2"; +`, + }, + { path: "/lib1.ts", content: "export const b = 1, d = 2;" }, + { path: "/lib2.ts", content: "export const a = 3, c = 4;" }); + + testOrganizeExports("CoalesceTrivia", + { + path: "/test.ts", + content: ` +/*A*/export /*B*/ { /*C*/ F2 /*D*/ } /*E*/ from /*F*/ "lib" /*G*/;/*H*/ //I +/*J*/export /*K*/ { /*L*/ F1 /*M*/ } /*N*/ from /*O*/ "lib" /*P*/;/*Q*/ //R +`, + }, + libFile); + + testOrganizeExports("SortTrivia", + { + path: "/test.ts", + content: ` +/*A*/export /*B*/ * /*C*/ from /*D*/ "lib2" /*E*/;/*F*/ //G +/*H*/export /*I*/ * /*J*/ from /*K*/ "lib1" /*L*/;/*M*/ //N +`, + }, + { path: "/lib1.ts", content: "" }, + { path: "/lib2.ts", content: "" }); + + testOrganizeExports("SortHeaderComment", + { + path: "/test.ts", + content: ` +// Header +export * from "lib2"; +export * from "lib1"; +`, + }, + { path: "/lib1.ts", content: "" }, + { path: "/lib2.ts", content: "" }); + + testOrganizeExports("AmbientModule", + { + path: "/test.ts", + content: ` +declare module "mod" { + export { F1 } from "lib"; + export * from "lib"; + export { F2 } from "lib"; +} + `, + }, + libFile); + + testOrganizeExports("TopLevelAndAmbientModule", + { + path: "/test.ts", + content: ` +export { D } from "lib"; + +declare module "mod" { + export { F1 } from "lib"; + export * from "lib"; + export { F2 } from "lib"; +} + +export { E } from "lib"; +export * from "lib"; +`, + }, + libFile); + }); + + function testOrganizeExports(testName: string, testFile: TestFSWithWatch.File, ...otherFiles: TestFSWithWatch.File[]) { + testOrganizeImports(`${testName}.exports`, testFile, ...otherFiles); + } + function testOrganizeImports(testName: string, testFile: TestFSWithWatch.File, ...otherFiles: TestFSWithWatch.File[]) { it(testName, () => runBaseline(`organizeImports/${testName}.ts`, testFile, ...otherFiles)); } @@ -509,6 +736,13 @@ import { React, Other } from "react"; return imports; } + function parseExports(...exportStrings: string[]): ReadonlyArray { + const sourceFile = createSourceFile("a.ts", exportStrings.join("\n"), ScriptTarget.ES2015, /*setParentNodes*/ true, ScriptKind.TS); + const exports = filter(sourceFile.statements, isExportDeclaration); + assert.equal(exports.length, exportStrings.length); + return exports; + } + function assertEqual(node1?: Node, node2?: Node) { if (node1 === undefined) { assert.isUndefined(node2); @@ -550,6 +784,23 @@ import { React, Other } from "react"; assertEqual(is1.name, is2.name); assertEqual(is1.propertyName, is2.propertyName); break; + case SyntaxKind.ExportDeclaration: + const ed1 = node1 as ExportDeclaration; + const ed2 = node2 as ExportDeclaration; + assertEqual(ed1.exportClause, ed2.exportClause); + assertEqual(ed1.moduleSpecifier, ed2.moduleSpecifier); + break; + case SyntaxKind.NamedExports: + const ne1 = node1 as NamedExports; + const ne2 = node2 as NamedExports; + assertListEqual(ne1.elements, ne2.elements); + break; + case SyntaxKind.ExportSpecifier: + const es1 = node1 as ExportSpecifier; + const es2 = node2 as ExportSpecifier; + assertEqual(es1.name, es2.name); + assertEqual(es1.propertyName, es2.propertyName); + break; case SyntaxKind.Identifier: const id1 = node1 as Identifier; const id2 = node2 as Identifier; diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index fa30b5cd30e..4bee286789c 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -21,15 +21,23 @@ namespace ts.OrganizeImports { const topLevelImportDecls = sourceFile.statements.filter(isImportDeclaration); organizeImportsWorker(topLevelImportDecls); + // All of the old ExportDeclarations in the file, in syntactic order. + const topLevelExportDecls = sourceFile.statements.filter(isExportDeclaration); + organizeImportsWorker(topLevelExportDecls); + for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) { const ambientModuleBody = getModuleBlock(ambientModule as ModuleDeclaration); + const ambientModuleImportDecls = ambientModuleBody.statements.filter(isImportDeclaration); organizeImportsWorker(ambientModuleImportDecls); + + const ambientModuleExportDecls = ambientModuleBody.statements.filter(isExportDeclaration); + organizeImportsWorker(ambientModuleExportDecls); } return changeTracker.getChanges(); - function organizeImportsWorker(oldImportDecls: ReadonlyArray) { + function organizeImportsWorker(oldImportDecls: ReadonlyArray) { if (length(oldImportDecls) === 0) { return; } @@ -41,11 +49,15 @@ namespace ts.OrganizeImports { // but the consequences of being wrong are very minor. suppressLeadingTrivia(oldImportDecls[0]); + const areImports = isImportDeclaration(oldImportDecls[0]); + const oldImportGroups = group(oldImportDecls, importDecl => getExternalModuleName(importDecl.moduleSpecifier)); const sortedImportGroups = stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier)); const newImportDecls = flatMap(sortedImportGroups, importGroup => getExternalModuleName(importGroup[0].moduleSpecifier) - ? coalesceImports(removeUnusedImports(importGroup, sourceFile, program)) + ? areImports + ? coalesceImports(removeUnusedImports(importGroup as ReadonlyArray, sourceFile, program)) + : coalesceExports(importGroup as ReadonlyArray) : importGroup); // Delete or replace the first import. @@ -131,7 +143,9 @@ namespace ts.OrganizeImports { } function getExternalModuleName(specifier: Expression) { - return isStringLiteralLike(specifier) ? specifier.text : undefined; + return specifier !== undefined && isStringLiteralLike(specifier) + ? specifier.text + : undefined; } /* @internal */ // Internal for testing @@ -254,9 +268,71 @@ namespace ts.OrganizeImports { namedImports, }; } + } - function compareIdentifiers(s1: Identifier, s2: Identifier) { - return compareStringsCaseInsensitive(s1.text, s2.text); + /* @internal */ // Internal for testing + /** + * @param exportGroup a list of ExportDeclarations, all with the same module name. + */ + export function coalesceExports(exportGroup: ReadonlyArray) { + if (exportGroup.length === 0) { + return exportGroup; + } + + const { exportWithoutClause, namedExports } = getCategorizedExports(exportGroup); + + const coalescedExports: ExportDeclaration[] = []; + + if (exportWithoutClause) { + coalescedExports.push(exportWithoutClause); + } + + if (namedExports.length === 0) { + return coalescedExports; + } + + const newExportSpecifiers: ExportSpecifier[] = []; + newExportSpecifiers.push(...flatMap(namedExports, i => (i.exportClause).elements)); + + const sortedExportSpecifiers = stableSort(newExportSpecifiers, (s1, s2) => + compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) || + compareIdentifiers(s1.name, s2.name)); + + const exportDecl = namedExports[0]; + coalescedExports.push( + updateExportDeclaration( + exportDecl, + exportDecl.decorators, + exportDecl.modifiers, + updateNamedExports(exportDecl.exportClause, sortedExportSpecifiers), + exportDecl.moduleSpecifier)); + + return coalescedExports; + + /* + * Returns entire export declarations because they may already have been rewritten and + * may lack parent pointers. The desired parts can easily be recovered based on the + * categorization. + */ + function getCategorizedExports(exportGroup: ReadonlyArray) { + let exportWithoutClause: ExportDeclaration | undefined; + const namedExports: ExportDeclaration[] = []; + + for (const exportDeclaration of exportGroup) { + if (exportDeclaration.exportClause === undefined) { + // Only the first such export is interesting - the others are redundant. + // Note: Unfortunately, we will lose trivia that was on this node. + exportWithoutClause = exportWithoutClause || exportDeclaration; + } + else { + namedExports.push(exportDeclaration); + } + } + + return { + exportWithoutClause, + namedExports, + }; } } @@ -281,4 +357,8 @@ namespace ts.OrganizeImports { compareBooleans(isExternalModuleNameRelative(name1), isExternalModuleNameRelative(name2)) || compareStringsCaseInsensitive(name1, name2); } -} \ No newline at end of file + + function compareIdentifiers(s1: Identifier, s2: Identifier) { + return compareStringsCaseInsensitive(s1.text, s2.text); + } +} diff --git a/tests/baselines/reference/organizeImports/AmbientModule.exports.ts b/tests/baselines/reference/organizeImports/AmbientModule.exports.ts new file mode 100644 index 00000000000..80403e42f4e --- /dev/null +++ b/tests/baselines/reference/organizeImports/AmbientModule.exports.ts @@ -0,0 +1,15 @@ +// ==ORIGINAL== + +declare module "mod" { + export { F1 } from "lib"; + export * from "lib"; + export { F2 } from "lib"; +} + +// ==ORGANIZED== + +declare module "mod" { + export * from "lib"; + export { F1, F2 } from "lib"; +} + \ No newline at end of file diff --git a/tests/baselines/reference/organizeImports/CoalesceMultipleModules.exports.ts b/tests/baselines/reference/organizeImports/CoalesceMultipleModules.exports.ts new file mode 100644 index 00000000000..cb5114b0c25 --- /dev/null +++ b/tests/baselines/reference/organizeImports/CoalesceMultipleModules.exports.ts @@ -0,0 +1,11 @@ +// ==ORIGINAL== + +export { d } from "lib1"; +export { b } from "lib1"; +export { c } from "lib2"; +export { a } from "lib2"; + +// ==ORGANIZED== + +export { b, d } from "lib1"; +export { a, c } from "lib2"; diff --git a/tests/baselines/reference/organizeImports/CoalesceTrivia.exports.ts b/tests/baselines/reference/organizeImports/CoalesceTrivia.exports.ts new file mode 100644 index 00000000000..f0ff1f550cd --- /dev/null +++ b/tests/baselines/reference/organizeImports/CoalesceTrivia.exports.ts @@ -0,0 +1,8 @@ +// ==ORIGINAL== + +/*A*/export /*B*/ { /*C*/ F2 /*D*/ } /*E*/ from /*F*/ "lib" /*G*/;/*H*/ //I +/*J*/export /*K*/ { /*L*/ F1 /*M*/ } /*N*/ from /*O*/ "lib" /*P*/;/*Q*/ //R + +// ==ORGANIZED== + +/*A*/export /*B*/ { /*L*/ F1 /*M*/, /*C*/ F2 /*D*/ } /*E*/ from /*F*/ "lib" /*G*/; /*H*/ //I diff --git a/tests/baselines/reference/organizeImports/MoveToTop.exports.ts b/tests/baselines/reference/organizeImports/MoveToTop.exports.ts new file mode 100644 index 00000000000..85016084b48 --- /dev/null +++ b/tests/baselines/reference/organizeImports/MoveToTop.exports.ts @@ -0,0 +1,13 @@ +// ==ORIGINAL== + +export { F1, F2 } from "lib"; +1; +export * from "lib"; +2; + +// ==ORGANIZED== + +export * from "lib"; +export { F1, F2 } from "lib"; +1; +2; diff --git a/tests/baselines/reference/organizeImports/MoveToTop_Invalid.exports.ts b/tests/baselines/reference/organizeImports/MoveToTop_Invalid.exports.ts new file mode 100644 index 00000000000..6479e78c698 --- /dev/null +++ b/tests/baselines/reference/organizeImports/MoveToTop_Invalid.exports.ts @@ -0,0 +1,20 @@ +// ==ORIGINAL== + +export { F1, F2 } from "lib"; +1; +export * from "lib"; +2; +export { b } from `${'lib'}`; +export { a } from `${'lib'}`; +export { D } from "lib"; +3; + +// ==ORGANIZED== + +export * from "lib"; +export { D, F1, F2 } from "lib"; +export { b } from `${'lib'}`; +export { a } from `${'lib'}`; +1; +2; +3; diff --git a/tests/baselines/reference/organizeImports/MoveToTop_WithExportsFirst.exports.ts b/tests/baselines/reference/organizeImports/MoveToTop_WithExportsFirst.exports.ts new file mode 100644 index 00000000000..c52681b17a9 --- /dev/null +++ b/tests/baselines/reference/organizeImports/MoveToTop_WithExportsFirst.exports.ts @@ -0,0 +1,23 @@ +// ==ORIGINAL== + +export { F1, F2 } from "lib"; +1; +import { F1, F2 } from "lib"; +2; +export * from "lib"; +3; +import * as NS from "lib"; +4; +F1(); F2(); NS.F1(); + +// ==ORGANIZED== + +export * from "lib"; +export { F1, F2 } from "lib"; +1; +import * as NS from "lib"; +import { F1, F2 } from "lib"; +2; +3; +4; +F1(); F2(); NS.F1(); diff --git a/tests/baselines/reference/organizeImports/MoveToTop_WithImportsFirst.exports.ts b/tests/baselines/reference/organizeImports/MoveToTop_WithImportsFirst.exports.ts new file mode 100644 index 00000000000..5dc908f63a1 --- /dev/null +++ b/tests/baselines/reference/organizeImports/MoveToTop_WithImportsFirst.exports.ts @@ -0,0 +1,23 @@ +// ==ORIGINAL== + +import { F1, F2 } from "lib"; +1; +export { F1, F2 } from "lib"; +2; +import * as NS from "lib"; +3; +export * from "lib"; +4; +F1(); F2(); NS.F1(); + +// ==ORGANIZED== + +import * as NS from "lib"; +import { F1, F2 } from "lib"; +1; +export * from "lib"; +export { F1, F2 } from "lib"; +2; +3; +4; +F1(); F2(); NS.F1(); diff --git a/tests/baselines/reference/organizeImports/SortHeaderComment.exports.ts b/tests/baselines/reference/organizeImports/SortHeaderComment.exports.ts new file mode 100644 index 00000000000..e3c20f3b140 --- /dev/null +++ b/tests/baselines/reference/organizeImports/SortHeaderComment.exports.ts @@ -0,0 +1,11 @@ +// ==ORIGINAL== + +// Header +export * from "lib2"; +export * from "lib1"; + +// ==ORGANIZED== + +// Header +export * from "lib1"; +export * from "lib2"; diff --git a/tests/baselines/reference/organizeImports/SortTrivia.exports.ts b/tests/baselines/reference/organizeImports/SortTrivia.exports.ts new file mode 100644 index 00000000000..459b3ebbdfa --- /dev/null +++ b/tests/baselines/reference/organizeImports/SortTrivia.exports.ts @@ -0,0 +1,9 @@ +// ==ORIGINAL== + +/*A*/export /*B*/ * /*C*/ from /*D*/ "lib2" /*E*/;/*F*/ //G +/*H*/export /*I*/ * /*J*/ from /*K*/ "lib1" /*L*/;/*M*/ //N + +// ==ORGANIZED== + +/*A*//*H*/ export /*I*/ * /*J*/ from /*K*/ "lib1" /*L*/; /*M*/ //N +export /*B*/ * /*C*/ from /*D*/ "lib2" /*E*/; /*F*/ //G diff --git a/tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.exports.ts b/tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.exports.ts new file mode 100644 index 00000000000..53124c103b5 --- /dev/null +++ b/tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.exports.ts @@ -0,0 +1,23 @@ +// ==ORIGINAL== + +export { D } from "lib"; + +declare module "mod" { + export { F1 } from "lib"; + export * from "lib"; + export { F2 } from "lib"; +} + +export { E } from "lib"; +export * from "lib"; + +// ==ORGANIZED== + +export * from "lib"; +export { D, E } from "lib"; + +declare module "mod" { + export * from "lib"; + export { F1, F2 } from "lib"; +} + 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 22/40] 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 23/40] 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 24/40] 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 25/40] 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 7fcf1fdeb6317cab24e1e869e9768ecd7b40f98d Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 18 May 2018 10:49:10 -0700 Subject: [PATCH 26/40] Delete redundant tests --- src/harness/unittests/organizeImports.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/harness/unittests/organizeImports.ts b/src/harness/unittests/organizeImports.ts index ae544e4e0bd..94f99856777 100644 --- a/src/harness/unittests/organizeImports.ts +++ b/src/harness/unittests/organizeImports.ts @@ -44,13 +44,6 @@ namespace ts { assert.isEmpty(OrganizeImports.coalesceImports([])); }); - it("Sort specifiers", () => { - const sortedImports = parseImports(`import { default as m, a as n, b, y, z as o } from "lib";`); - const actualCoalescedImports = OrganizeImports.coalesceImports(sortedImports); - const expectedCoalescedImports = parseImports(`import { a as n, b, default as m, y, z as o } from "lib";`); - assertListEqual(actualCoalescedImports, expectedCoalescedImports); - }); - it("Sort specifiers - case-insensitive", () => { const sortedImports = parseImports(`import { default as M, a as n, B, y, Z as O } from "lib";`); const actualCoalescedImports = OrganizeImports.coalesceImports(sortedImports); @@ -186,13 +179,6 @@ namespace ts { assert.isEmpty(OrganizeImports.coalesceExports([])); }); - it("Sort specifiers", () => { - const sortedExports = parseExports(`export { default as m, a as n, b, y, z as o } from "lib";`); - const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); - const expectedCoalescedExports = parseExports(`export { a as n, b, default as m, y, z as o } from "lib";`); - assertListEqual(actualCoalescedExports, expectedCoalescedExports); - }); - it("Sort specifiers - case-insensitive", () => { const sortedExports = parseExports(`export { default as M, a as n, B, y, Z as O } from "lib";`); const actualCoalescedExports = OrganizeImports.coalesceExports(sortedExports); From 43e1edf10a3cc8986cf72316f7630194b6f92ded Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 18 May 2018 10:54:40 -0700 Subject: [PATCH 27/40] Eliminate runtime type check --- src/services/organizeImports.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 4bee286789c..5476352dbf5 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -17,27 +17,32 @@ namespace ts.OrganizeImports { const changeTracker = textChanges.ChangeTracker.fromContext({ host, formatContext }); + const coalesceAndOrganizeImports = (importGroup: ReadonlyArray) => coalesceImports(removeUnusedImports(importGroup, sourceFile, program)); + // All of the old ImportDeclarations in the file, in syntactic order. const topLevelImportDecls = sourceFile.statements.filter(isImportDeclaration); - organizeImportsWorker(topLevelImportDecls); + organizeImportsWorker(topLevelImportDecls, coalesceAndOrganizeImports); // All of the old ExportDeclarations in the file, in syntactic order. const topLevelExportDecls = sourceFile.statements.filter(isExportDeclaration); - organizeImportsWorker(topLevelExportDecls); + organizeImportsWorker(topLevelExportDecls, coalesceExports); for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) { const ambientModuleBody = getModuleBlock(ambientModule as ModuleDeclaration); const ambientModuleImportDecls = ambientModuleBody.statements.filter(isImportDeclaration); - organizeImportsWorker(ambientModuleImportDecls); + organizeImportsWorker(ambientModuleImportDecls, coalesceAndOrganizeImports); const ambientModuleExportDecls = ambientModuleBody.statements.filter(isExportDeclaration); - organizeImportsWorker(ambientModuleExportDecls); + organizeImportsWorker(ambientModuleExportDecls, coalesceExports); } return changeTracker.getChanges(); - function organizeImportsWorker(oldImportDecls: ReadonlyArray) { + function organizeImportsWorker( + oldImportDecls: ReadonlyArray, + coalesce: (group: ReadonlyArray) => ReadonlyArray) { + if (length(oldImportDecls) === 0) { return; } @@ -49,15 +54,11 @@ namespace ts.OrganizeImports { // but the consequences of being wrong are very minor. suppressLeadingTrivia(oldImportDecls[0]); - const areImports = isImportDeclaration(oldImportDecls[0]); - const oldImportGroups = group(oldImportDecls, importDecl => getExternalModuleName(importDecl.moduleSpecifier)); const sortedImportGroups = stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier)); const newImportDecls = flatMap(sortedImportGroups, importGroup => getExternalModuleName(importGroup[0].moduleSpecifier) - ? areImports - ? coalesceImports(removeUnusedImports(importGroup as ReadonlyArray, sourceFile, program)) - : coalesceExports(importGroup as ReadonlyArray) + ? coalesce(importGroup) : importGroup); // Delete or replace the first import. From 9e195676384b0fc1da257b4eb643e3cdcf3776a6 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Fri, 18 May 2018 11:23:27 -0700 Subject: [PATCH 28/40] 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: From 8f662a9131030b48cfd372ba90db66c534f7af3e Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 18 May 2018 12:53:28 -0700 Subject: [PATCH 29/40] Extract sorting helper --- src/services/organizeImports.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 5476352dbf5..99bac64973f 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -204,9 +204,7 @@ namespace ts.OrganizeImports { newImportSpecifiers.push(...flatMap(namedImports, i => (i.importClause.namedBindings as NamedImports).elements)); - const sortedImportSpecifiers = stableSort(newImportSpecifiers, (s1, s2) => - compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) || - compareIdentifiers(s1.name, s2.name)); + const sortedImportSpecifiers = sortSpecifiers(newImportSpecifiers); const importDecl = defaultImports.length > 0 ? defaultImports[0] @@ -295,9 +293,7 @@ namespace ts.OrganizeImports { const newExportSpecifiers: ExportSpecifier[] = []; newExportSpecifiers.push(...flatMap(namedExports, i => (i.exportClause).elements)); - const sortedExportSpecifiers = stableSort(newExportSpecifiers, (s1, s2) => - compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) || - compareIdentifiers(s1.name, s2.name)); + const sortedExportSpecifiers = sortSpecifiers(newExportSpecifiers); const exportDecl = namedExports[0]; coalescedExports.push( @@ -350,6 +346,12 @@ namespace ts.OrganizeImports { importDeclaration.moduleSpecifier); } + function sortSpecifiers(specifiers: ReadonlyArray) { + return stableSort(specifiers, (s1, s2) => + compareIdentifiers(s1.propertyName || s1.name, s2.propertyName || s2.name) || + compareIdentifiers(s1.name, s2.name)); + } + /* internal */ // Exported for testing export function compareModuleSpecifiers(m1: Expression, m2: Expression) { const name1 = getExternalModuleName(m1); From 7f0258bcb987d543f3638a97c5ecd60c8f1882ab Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 18 May 2018 13:20:13 -0700 Subject: [PATCH 30/40] getJSDocHost always returns a defined result (#24255) --- src/compiler/checker.ts | 3 +-- src/compiler/utilities.ts | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2650e50a04e..ba85e090265 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2172,8 +2172,7 @@ namespace ts { return; } const host = getJSDocHost(node); - if (host && - isExpressionStatement(host) && + if (isExpressionStatement(host) && isBinaryExpression(host.expression) && getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) { const symbol = getSymbolOfNode(host.expression.left); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index fa6f65640da..300c6421dbc 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1927,11 +1927,7 @@ namespace ts { } 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; - } + return Debug.assertDefined(findAncestor(node.parent, isJSDoc)).parent; } export function getTypeParameterFromJsDoc(node: TypeParameterDeclaration & { parent: JSDocTemplateTag }): TypeParameterDeclaration | undefined { From 1df79970144489924daa2fa1ef056d847488a8a5 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 18 May 2018 13:53:27 -0700 Subject: [PATCH 31/40] getJSDocTypeParameterDeclarations: Avoid unnecessary array (#24257) --- src/compiler/utilities.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 300c6421dbc..df19a8948c7 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3114,9 +3114,9 @@ namespace ts { } export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray { - const tags = filter(getJSDocTags(node), isJSDocTemplateTag); // 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))); + const tag = find(getJSDocTags(node), (tag): tag is JSDocTemplateTag => + isJSDocTemplateTag(tag) && !(tag.parent.kind === SyntaxKind.JSDocComment && tag.parent.tags!.some(isJSDocTypeAlias))); return (tag && tag.typeParameters) || emptyArray; } From 3eb66da155fc96825b44442af5cfb51cfdd8442a Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 18 May 2018 15:25:24 -0700 Subject: [PATCH 32/40] Add code fix to remove unused label (#24037) * Add code fix to remove unused label * Test with trivia and fix indentation with dedented label --- src/compiler/diagnosticMessages.json | 8 ++++++ src/harness/tsconfig.json | 1 + src/server/tsconfig.json | 1 + src/server/tsconfig.library.json | 1 + src/services/codefixes/fixUnusedLabel.ts | 25 +++++++++++++++++++ src/services/tsconfig.json | 1 + tests/cases/fourslash/codeFixUnusedLabel.ts | 11 ++++++++ .../cases/fourslash/codeFixUnusedLabel_all.ts | 21 ++++++++++++++++ 8 files changed, 69 insertions(+) create mode 100644 src/services/codefixes/fixUnusedLabel.ts create mode 100644 tests/cases/fourslash/codeFixUnusedLabel.ts create mode 100644 tests/cases/fourslash/codeFixUnusedLabel_all.ts diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 61961913280..078bd600771 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4261,5 +4261,13 @@ "Add missing typeof": { "category": "Message", "code": 95052 + }, + "Remove unused label": { + "category": "Message", + "code": 95053 + }, + "Remove all unused labels": { + "category": "Message", + "code": 95054 } } diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index 4fb96dbe93d..359701a02cb 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -106,6 +106,7 @@ "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", "../services/codefixes/fixUnreachableCode.ts", + "../services/codefixes/fixUnusedLabel.ts", "../services/codefixes/fixJSDocTypes.ts", "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 50e06eb3f23..8ae6974baf0 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -102,6 +102,7 @@ "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", "../services/codefixes/fixUnreachableCode.ts", + "../services/codefixes/fixUnusedLabel.ts", "../services/codefixes/fixJSDocTypes.ts", "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index 43e8fd1857b..922af11e879 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -108,6 +108,7 @@ "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", "../services/codefixes/fixUnreachableCode.ts", + "../services/codefixes/fixUnusedLabel.ts", "../services/codefixes/fixJSDocTypes.ts", "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", diff --git a/src/services/codefixes/fixUnusedLabel.ts b/src/services/codefixes/fixUnusedLabel.ts new file mode 100644 index 00000000000..b99f72d6839 --- /dev/null +++ b/src/services/codefixes/fixUnusedLabel.ts @@ -0,0 +1,25 @@ +/* @internal */ +namespace ts.codefix { + const fixId = "fixUnusedLabel"; + const errorCodes = [Diagnostics.Unused_label.code]; + registerCodeFix({ + errorCodes, + getCodeActions(context) { + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, context.sourceFile, context.span.start)); + return [createCodeFixAction(fixId, changes, Diagnostics.Remove_unused_label, fixId, Diagnostics.Remove_all_unused_labels)]; + }, + fixIds: [fixId], + getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => doChange(changes, diag.file, diag.start)), + }); + + function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, start: number): void { + const token = getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false); + const labeledStatement = cast(token.parent, isLabeledStatement); + const pos = token.getStart(sourceFile); + const statementPos = labeledStatement.statement.getStart(sourceFile); + // If label is on a separate line, just delete the rest of that line, but not the indentation of the labeled statement. + const end = positionsAreOnSameLine(pos, statementPos, sourceFile) ? statementPos + : skipTrivia(sourceFile.text, findChildOfKind(labeledStatement, SyntaxKind.ColonToken, sourceFile)!.end, /*stopAfterLineBreak*/ true); + changes.deleteRange(sourceFile, { pos, end }); + } +} diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index d78086504c9..7e1ccc9c3af 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -99,6 +99,7 @@ "codefixes/fixForgottenThisPropertyAccess.ts", "codefixes/fixUnusedIdentifier.ts", "codefixes/fixUnreachableCode.ts", + "codefixes/fixUnusedLabel.ts", "codefixes/fixJSDocTypes.ts", "codefixes/fixAwaitInSyncFunction.ts", "codefixes/disableJsDiagnostics.ts", diff --git a/tests/cases/fourslash/codeFixUnusedLabel.ts b/tests/cases/fourslash/codeFixUnusedLabel.ts new file mode 100644 index 00000000000..0feea173b0c --- /dev/null +++ b/tests/cases/fourslash/codeFixUnusedLabel.ts @@ -0,0 +1,11 @@ +/// + +// @noUnusedLocals: true + +/////* a */label/* b */:/* c */while (1) {} + +verify.codeFix({ + description: "Remove unused label", + newFileContent: +`/* a */while (1) {}`, +}); diff --git a/tests/cases/fourslash/codeFixUnusedLabel_all.ts b/tests/cases/fourslash/codeFixUnusedLabel_all.ts new file mode 100644 index 00000000000..2769e0a65ee --- /dev/null +++ b/tests/cases/fourslash/codeFixUnusedLabel_all.ts @@ -0,0 +1,21 @@ +/// + +// @noUnusedLocals: true + +////label1: while (1) {} +//// +////function f() { +////label2: +//// while (1) {} +////} + +verify.codeFixAll({ + fixId: "fixUnusedLabel", + fixAllDescription: "Remove all unused labels", + newFileContent: +`while (1) {} + +function f() { + while (1) {} +}`, +}); From 4c22bf786ea01f9ad382e5d8e915326674a6a173 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 18 May 2018 16:42:42 -0700 Subject: [PATCH 33/40] getEditsForFileRename: Do fresh module resolution instead of relying on cache (#24211) * getEditsForFileRename: Do fresh module resolution instead of relying on cache * Add host.resolveModuleNameWithFailedLookupLocations method * Make host.resolveModuleNameWithFailedLookupLocations mandatory, and implement for Project * Add test, and no need to check host.fileExists * Change method name and always use cache * Update name in string --- src/compiler/resolutionCache.ts | 13 ++++++-- .../unittests/tsserverProjectSystem.ts | 31 +++++++++++++++++++ src/server/project.ts | 4 +++ src/services/getEditsForFileRename.ts | 8 +++-- src/services/types.ts | 3 ++ .../reference/api/tsserverlibrary.d.ts | 2 ++ tests/baselines/reference/api/typescript.d.ts | 1 + 7 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 9e0f3712ab9..dea5463b2ff 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -6,6 +6,7 @@ namespace ts { finishRecordingFilesWithChangedResolutions(): Path[]; resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined): ResolvedModuleFull[]; + getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations; resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; invalidateResolutionOfFile(filePath: Path): void; @@ -73,7 +74,7 @@ namespace ts { export const maxNumberOfFilesToIterateForInvalidation = 256; type GetResolutionWithResolvedFileName = - (resolution: T) => R; + (resolution: T) => R | undefined; export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootDirForResolution: string, logChangesWhenResolvingModule: boolean): ResolutionCache { let filesWithChangedSetOfUnresolvedImports: Path[] | undefined; @@ -124,6 +125,7 @@ namespace ts { startCachingPerDirectoryResolution: clearPerDirectoryResolutions, finishCachingPerDirectoryResolution, resolveModuleNames, + getResolvedModuleWithFailedLookupLocationsFromCache, resolveTypeReferenceDirectives, removeResolutionsOfFile, invalidateResolutionOfFile, @@ -320,7 +322,7 @@ namespace ts { } function resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[] { - return resolveNamesWithLocalCache( + return resolveNamesWithLocalCache( typeDirectiveNames, containingFile, resolvedTypeReferenceDirectives, perDirectoryResolvedTypeReferenceDirectives, resolveTypeReferenceDirective, getResolvedTypeReferenceDirective, @@ -329,7 +331,7 @@ namespace ts { } function resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined): ResolvedModuleFull[] { - return resolveNamesWithLocalCache( + return resolveNamesWithLocalCache( moduleNames, containingFile, resolvedModuleNames, perDirectoryResolvedModuleNames, resolveModuleName, getResolvedModule, @@ -337,6 +339,11 @@ namespace ts { ); } + function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined { + const cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile)); + return cache && cache.get(moduleName); + } + function isNodeModulesDirectory(dirPath: Path) { return endsWith(dirPath, "/node_modules"); } diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 8524d46e094..7a5f97b06d5 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -8383,4 +8383,35 @@ new C();` verifyCompletionListWithNewFileInSubFolder(TestFSWithWatch.Tsc_WatchDirectory.DynamicPolling); }); }); + + describe("tsserverProjectSystem getEditsForFileRename", () => { + it("works for host implementing 'resolveModuleNames' and 'getResolvedModuleWithFailedLookupLocationsFromCache'", () => { + const userTs: File = { + path: "/user.ts", + content: 'import { x } from "./old";', + }; + + const host = createServerHost([userTs]); + const projectService = createProjectService(host); + projectService.openClientFile(userTs.path); + const project = first(projectService.inferredProjects); + + Debug.assert(!!project.resolveModuleNames); + + const edits = project.getLanguageService().getEditsForFileRename("/old.ts", "/new.ts", testFormatOptions); + assert.deepEqual>(edits, [{ + fileName: "/user.ts", + textChanges: [{ + span: textSpanFromSubstring(userTs.content, "./old"), + newText: "./new", + }], + }]); + }); + }); + + function textSpanFromSubstring(str: string, substring: string): TextSpan { + const start = str.indexOf(substring); + Debug.assert(start !== -1); + return createTextSpan(start, substring.length); + } } diff --git a/src/server/project.ts b/src/server/project.ts index 5b1dbddfc20..754d061235d 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -358,6 +358,10 @@ namespace ts.server { return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames); } + getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations { + return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile); + } + resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[] { return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); } diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index f8bcf02d036..d05d22a98d9 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -4,7 +4,7 @@ namespace ts { const pathUpdater = getPathUpdater(oldFilePath, newFilePath, host); return textChanges.ChangeTracker.with({ host, formatContext }, changeTracker => { updateTsconfigFiles(program, changeTracker, oldFilePath, newFilePath); - for (const { sourceFile, toUpdate } of getImportsToUpdate(program, oldFilePath)) { + for (const { sourceFile, toUpdate } of getImportsToUpdate(program, oldFilePath, host)) { const newPath = pathUpdater(isRef(toUpdate) ? toUpdate.fileName : toUpdate.text); if (newPath !== undefined) { const range = isRef(toUpdate) ? toUpdate : createStringRange(toUpdate, sourceFile); @@ -30,7 +30,7 @@ namespace ts { return "fileName" in toUpdate; } - function getImportsToUpdate(program: Program, oldFilePath: string): ReadonlyArray { + function getImportsToUpdate(program: Program, oldFilePath: string, host: LanguageServiceHost): ReadonlyArray { const checker = program.getTypeChecker(); const result: ToUpdate[] = []; for (const sourceFile of program.getSourceFiles()) { @@ -44,7 +44,9 @@ namespace ts { // If it resolved to something already, ignore. if (checker.getSymbolAtLocation(importStringLiteral)) continue; - const resolved = program.getResolvedModuleWithFailedLookupLocationsFromCache(importStringLiteral.text, sourceFile.fileName); + const resolved = host.resolveModuleNames + ? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importStringLiteral.text, sourceFile.fileName) + : program.getResolvedModuleWithFailedLookupLocationsFromCache(importStringLiteral.text, sourceFile.fileName); if (resolved && contains(resolved.failedLookupLocations, oldFilePath)) { result.push({ sourceFile, toUpdate: importStringLiteral }); } diff --git a/src/services/types.ts b/src/services/types.ts index 0e9dbccbd1b..b8e2c488b17 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -207,8 +207,11 @@ namespace ts { * LS host can optionally implement this method if it wants to be completely in charge of module name resolution. * if implementation is omitted then language service will use built-in module resolution logic and get answers to * host specific questions using 'getScriptSnapshot'. + * + * If this is implemented, `getResolvedModuleWithFailedLookupLocationsFromCache` should be too. */ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModule[]; + getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations; resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; /* @internal */ hasInvalidatedResolution?: HasInvalidatedResolution; /* @internal */ hasChangedAutomaticTypeDirectiveNames?: boolean; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index ae163fb4f8d..cbf39a2a48f 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4477,6 +4477,7 @@ declare namespace ts { fileExists?(path: string): boolean; getTypeRootsVersion?(): number; resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModule[]; + getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations; resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getDirectories?(directoryName: string): string[]; /** @@ -7864,6 +7865,7 @@ declare namespace ts.server { readFile(fileName: string): string | undefined; fileExists(file: string): boolean; resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModuleFull[]; + getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations; resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists(path: string): boolean; getDirectories(path: string): string[]; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 89552e727c2..b449fc853c6 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4477,6 +4477,7 @@ declare namespace ts { fileExists?(path: string): boolean; getTypeRootsVersion?(): number; resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModule[]; + getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string): ResolvedModuleWithFailedLookupLocations; resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getDirectories?(directoryName: string): string[]; /** From 02fe840732db45d2b8913ee3ae37d4e530730083 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 18 May 2018 18:30:23 -0700 Subject: [PATCH 34/40] Get constraint with this argument of the type parameter for comparisons (#21210) * Get constraint with this argument of the type parameter for comparisons * Also instantiate indexed accesses * Add much simpler test --- src/compiler/checker.ts | 9 +- .../reference/collectionPatternNoError.js | 67 ++++++++++ .../collectionPatternNoError.symbols | 112 +++++++++++++++++ .../reference/collectionPatternNoError.types | 118 ++++++++++++++++++ tests/baselines/reference/fuzzy.errors.txt | 2 - ...subclassWithPolymorphicThisIsAssignable.js | 31 +++++ ...assWithPolymorphicThisIsAssignable.symbols | 34 +++++ ...classWithPolymorphicThisIsAssignable.types | 35 ++++++ .../compiler/collectionPatternNoError.ts | 36 ++++++ ...subclassWithPolymorphicThisIsAssignable.ts | 16 +++ 10 files changed, 455 insertions(+), 5 deletions(-) create mode 100644 tests/baselines/reference/collectionPatternNoError.js create mode 100644 tests/baselines/reference/collectionPatternNoError.symbols create mode 100644 tests/baselines/reference/collectionPatternNoError.types create mode 100644 tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.js create mode 100644 tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.symbols create mode 100644 tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.types create mode 100644 tests/cases/compiler/collectionPatternNoError.ts create mode 100644 tests/cases/compiler/subclassWithPolymorphicThisIsAssignable.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 90cd56572ac..9f3c8fa6fd7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10954,9 +10954,12 @@ namespace ts { return result; } } - else if (result = isRelatedTo(constraint, target, reportErrors)) { - errorInfo = saveErrorInfo; - return result; + else { + const instantiated = getTypeWithThisArgument(constraint, source); + if (result = isRelatedTo(instantiated, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } else if (source.flags & TypeFlags.Index) { diff --git a/tests/baselines/reference/collectionPatternNoError.js b/tests/baselines/reference/collectionPatternNoError.js new file mode 100644 index 00000000000..eff09af0267 --- /dev/null +++ b/tests/baselines/reference/collectionPatternNoError.js @@ -0,0 +1,67 @@ +//// [collectionPatternNoError.ts] +interface MsgConstructor { + new(data: Array<{}>): T; +} +class Message { + clone(): this { + return this; + } +} +interface MessageList extends Message { + methodOnMessageList(): T[]; +} + +function fetchMsg(protoCtor: MsgConstructor): V { + return null!; +} + +class DataProvider> { + constructor( + private readonly message: MsgConstructor, + private readonly messageList: MsgConstructor, + ) { } + + fetch() { + const messageList = fetchMsg(this.messageList); + messageList.methodOnMessageList(); + } +} + +// The same bug as the above but using indexed accesses +// (won't surface directly unless unsound indexed access assignments are forbidden) +function f< + U extends {TType: MessageList}, + T extends Message +>(message: MsgConstructor, messageList: MsgConstructor) { + fetchMsg(messageList).methodOnMessageList(); +} + + +//// [collectionPatternNoError.js] +var Message = /** @class */ (function () { + function Message() { + } + Message.prototype.clone = function () { + return this; + }; + return Message; +}()); +function fetchMsg(protoCtor) { + return null; +} +var DataProvider = /** @class */ (function () { + function DataProvider(message, messageList) { + this.message = message; + this.messageList = messageList; + } + DataProvider.prototype.fetch = function () { + var messageList = fetchMsg(this.messageList); + messageList.methodOnMessageList(); + }; + return DataProvider; +}()); +// The same bug as the above but using indexed accesses +// (won't surface directly unless unsound indexed access assignments are forbidden) +function f(message, messageList) { + fetchMsg(messageList).methodOnMessageList(); +} diff --git a/tests/baselines/reference/collectionPatternNoError.symbols b/tests/baselines/reference/collectionPatternNoError.symbols new file mode 100644 index 00000000000..be9bffdac6d --- /dev/null +++ b/tests/baselines/reference/collectionPatternNoError.symbols @@ -0,0 +1,112 @@ +=== tests/cases/compiler/collectionPatternNoError.ts === +interface MsgConstructor { +>MsgConstructor : Symbol(MsgConstructor, Decl(collectionPatternNoError.ts, 0, 0)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 0, 25)) +>Message : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) + + new(data: Array<{}>): T; +>data : Symbol(data, Decl(collectionPatternNoError.ts, 1, 6)) +>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 0, 25)) +} +class Message { +>Message : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) + + clone(): this { +>clone : Symbol(Message.clone, Decl(collectionPatternNoError.ts, 3, 15)) + + return this; +>this : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) + } +} +interface MessageList extends Message { +>MessageList : Symbol(MessageList, Decl(collectionPatternNoError.ts, 7, 1)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 8, 22)) +>Message : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) +>Message : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) + + methodOnMessageList(): T[]; +>methodOnMessageList : Symbol(MessageList.methodOnMessageList, Decl(collectionPatternNoError.ts, 8, 58)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 8, 22)) +} + +function fetchMsg(protoCtor: MsgConstructor): V { +>fetchMsg : Symbol(fetchMsg, Decl(collectionPatternNoError.ts, 10, 1)) +>V : Symbol(V, Decl(collectionPatternNoError.ts, 12, 18)) +>Message : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) +>protoCtor : Symbol(protoCtor, Decl(collectionPatternNoError.ts, 12, 37)) +>MsgConstructor : Symbol(MsgConstructor, Decl(collectionPatternNoError.ts, 0, 0)) +>V : Symbol(V, Decl(collectionPatternNoError.ts, 12, 18)) +>V : Symbol(V, Decl(collectionPatternNoError.ts, 12, 18)) + + return null!; +} + +class DataProvider> { +>DataProvider : Symbol(DataProvider, Decl(collectionPatternNoError.ts, 14, 1)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 16, 19)) +>Message : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) +>U : Symbol(U, Decl(collectionPatternNoError.ts, 16, 37)) +>MessageList : Symbol(MessageList, Decl(collectionPatternNoError.ts, 7, 1)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 16, 19)) + + constructor( + private readonly message: MsgConstructor, +>message : Symbol(DataProvider.message, Decl(collectionPatternNoError.ts, 17, 14)) +>MsgConstructor : Symbol(MsgConstructor, Decl(collectionPatternNoError.ts, 0, 0)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 16, 19)) + + private readonly messageList: MsgConstructor, +>messageList : Symbol(DataProvider.messageList, Decl(collectionPatternNoError.ts, 18, 48)) +>MsgConstructor : Symbol(MsgConstructor, Decl(collectionPatternNoError.ts, 0, 0)) +>U : Symbol(U, Decl(collectionPatternNoError.ts, 16, 37)) + + ) { } + + fetch() { +>fetch : Symbol(DataProvider.fetch, Decl(collectionPatternNoError.ts, 20, 7)) + + const messageList = fetchMsg(this.messageList); +>messageList : Symbol(messageList, Decl(collectionPatternNoError.ts, 23, 9)) +>fetchMsg : Symbol(fetchMsg, Decl(collectionPatternNoError.ts, 10, 1)) +>this.messageList : Symbol(DataProvider.messageList, Decl(collectionPatternNoError.ts, 18, 48)) +>this : Symbol(DataProvider, Decl(collectionPatternNoError.ts, 14, 1)) +>messageList : Symbol(DataProvider.messageList, Decl(collectionPatternNoError.ts, 18, 48)) + + messageList.methodOnMessageList(); +>messageList.methodOnMessageList : Symbol(MessageList.methodOnMessageList, Decl(collectionPatternNoError.ts, 8, 58)) +>messageList : Symbol(messageList, Decl(collectionPatternNoError.ts, 23, 9)) +>methodOnMessageList : Symbol(MessageList.methodOnMessageList, Decl(collectionPatternNoError.ts, 8, 58)) + } +} + +// The same bug as the above but using indexed accesses +// (won't surface directly unless unsound indexed access assignments are forbidden) +function f< +>f : Symbol(f, Decl(collectionPatternNoError.ts, 26, 1)) + + U extends {TType: MessageList}, +>U : Symbol(U, Decl(collectionPatternNoError.ts, 30, 11)) +>TType : Symbol(TType, Decl(collectionPatternNoError.ts, 31, 13)) +>MessageList : Symbol(MessageList, Decl(collectionPatternNoError.ts, 7, 1)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 31, 36)) + + T extends Message +>T : Symbol(T, Decl(collectionPatternNoError.ts, 31, 36)) +>Message : Symbol(Message, Decl(collectionPatternNoError.ts, 2, 1)) + +>(message: MsgConstructor, messageList: MsgConstructor) { +>message : Symbol(message, Decl(collectionPatternNoError.ts, 33, 2)) +>MsgConstructor : Symbol(MsgConstructor, Decl(collectionPatternNoError.ts, 0, 0)) +>T : Symbol(T, Decl(collectionPatternNoError.ts, 31, 36)) +>messageList : Symbol(messageList, Decl(collectionPatternNoError.ts, 33, 29)) +>MsgConstructor : Symbol(MsgConstructor, Decl(collectionPatternNoError.ts, 0, 0)) +>U : Symbol(U, Decl(collectionPatternNoError.ts, 30, 11)) + + fetchMsg(messageList).methodOnMessageList(); +>fetchMsg(messageList).methodOnMessageList : Symbol(MessageList.methodOnMessageList, Decl(collectionPatternNoError.ts, 8, 58)) +>fetchMsg : Symbol(fetchMsg, Decl(collectionPatternNoError.ts, 10, 1)) +>messageList : Symbol(messageList, Decl(collectionPatternNoError.ts, 33, 29)) +>methodOnMessageList : Symbol(MessageList.methodOnMessageList, Decl(collectionPatternNoError.ts, 8, 58)) +} + diff --git a/tests/baselines/reference/collectionPatternNoError.types b/tests/baselines/reference/collectionPatternNoError.types new file mode 100644 index 00000000000..c11af4e11d9 --- /dev/null +++ b/tests/baselines/reference/collectionPatternNoError.types @@ -0,0 +1,118 @@ +=== tests/cases/compiler/collectionPatternNoError.ts === +interface MsgConstructor { +>MsgConstructor : MsgConstructor +>T : T +>Message : Message + + new(data: Array<{}>): T; +>data : {}[] +>Array : T[] +>T : T +} +class Message { +>Message : Message + + clone(): this { +>clone : () => this + + return this; +>this : this + } +} +interface MessageList extends Message { +>MessageList : MessageList +>T : T +>Message : Message +>Message : Message + + methodOnMessageList(): T[]; +>methodOnMessageList : () => T[] +>T : T +} + +function fetchMsg(protoCtor: MsgConstructor): V { +>fetchMsg : (protoCtor: MsgConstructor) => V +>V : V +>Message : Message +>protoCtor : MsgConstructor +>MsgConstructor : MsgConstructor +>V : V +>V : V + + return null!; +>null! : null +>null : null +} + +class DataProvider> { +>DataProvider : DataProvider +>T : T +>Message : Message +>U : U +>MessageList : MessageList +>T : T + + constructor( + private readonly message: MsgConstructor, +>message : MsgConstructor +>MsgConstructor : MsgConstructor +>T : T + + private readonly messageList: MsgConstructor, +>messageList : MsgConstructor +>MsgConstructor : MsgConstructor +>U : U + + ) { } + + fetch() { +>fetch : () => void + + const messageList = fetchMsg(this.messageList); +>messageList : U +>fetchMsg(this.messageList) : U +>fetchMsg : (protoCtor: MsgConstructor) => V +>this.messageList : MsgConstructor +>this : this +>messageList : MsgConstructor + + messageList.methodOnMessageList(); +>messageList.methodOnMessageList() : T[] +>messageList.methodOnMessageList : () => T[] +>messageList : U +>methodOnMessageList : () => T[] + } +} + +// The same bug as the above but using indexed accesses +// (won't surface directly unless unsound indexed access assignments are forbidden) +function f< +>f : ; }, T extends Message>(message: MsgConstructor, messageList: MsgConstructor) => void + + U extends {TType: MessageList}, +>U : U +>TType : MessageList +>MessageList : MessageList +>T : T + + T extends Message +>T : T +>Message : Message + +>(message: MsgConstructor, messageList: MsgConstructor) { +>message : MsgConstructor +>MsgConstructor : MsgConstructor +>T : T +>messageList : MsgConstructor +>MsgConstructor : MsgConstructor +>U : U + + fetchMsg(messageList).methodOnMessageList(); +>fetchMsg(messageList).methodOnMessageList() : T[] +>fetchMsg(messageList).methodOnMessageList : () => T[] +>fetchMsg(messageList) : U["TType"] +>fetchMsg : (protoCtor: MsgConstructor) => V +>messageList : MsgConstructor +>methodOnMessageList : () => T[] +} + diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index b32f225a33e..c3f05fd7f2f 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -4,7 +4,6 @@ tests/cases/compiler/fuzzy.ts(21,13): error TS2322: Type '{ anything: number; on Types of property 'oneI' are incompatible. Type 'this' is not assignable to type 'I'. Type 'C' is not assignable to type 'I'. - Property 'alsoWorks' is missing in type 'C'. tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' cannot be converted to type 'R'. Property 'anything' is missing in type '{ oneI: this; }'. @@ -39,7 +38,6 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' canno !!! error TS2322: Types of property 'oneI' are incompatible. !!! error TS2322: Type 'this' is not assignable to type 'I'. !!! error TS2322: Type 'C' is not assignable to type 'I'. -!!! error TS2322: Property 'alsoWorks' is missing in type 'C'. } worksToo():R { diff --git a/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.js b/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.js new file mode 100644 index 00000000000..514257ca5b9 --- /dev/null +++ b/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.js @@ -0,0 +1,31 @@ +//// [subclassWithPolymorphicThisIsAssignable.ts] +/* taken from mongoose.Document */ +interface Document { + increment(): this; +} + +/* our custom model extends the mongoose document */ +interface CustomDocument extends Document { } + +export class Example { + constructor() { + // types of increment not compatible?? + this.test(); + } + + public test() { } +} + + +//// [subclassWithPolymorphicThisIsAssignable.js] +"use strict"; +exports.__esModule = true; +var Example = /** @class */ (function () { + function Example() { + // types of increment not compatible?? + this.test(); + } + Example.prototype.test = function () { }; + return Example; +}()); +exports.Example = Example; diff --git a/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.symbols b/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.symbols new file mode 100644 index 00000000000..9a0ff766abc --- /dev/null +++ b/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.symbols @@ -0,0 +1,34 @@ +=== tests/cases/compiler/subclassWithPolymorphicThisIsAssignable.ts === +/* taken from mongoose.Document */ +interface Document { +>Document : Symbol(Document, Decl(subclassWithPolymorphicThisIsAssignable.ts, 0, 0)) + + increment(): this; +>increment : Symbol(Document.increment, Decl(subclassWithPolymorphicThisIsAssignable.ts, 1, 20)) +} + +/* our custom model extends the mongoose document */ +interface CustomDocument extends Document { } +>CustomDocument : Symbol(CustomDocument, Decl(subclassWithPolymorphicThisIsAssignable.ts, 3, 1)) +>Document : Symbol(Document, Decl(subclassWithPolymorphicThisIsAssignable.ts, 0, 0)) + +export class Example { +>Example : Symbol(Example, Decl(subclassWithPolymorphicThisIsAssignable.ts, 6, 45)) +>Z : Symbol(Z, Decl(subclassWithPolymorphicThisIsAssignable.ts, 8, 21)) +>CustomDocument : Symbol(CustomDocument, Decl(subclassWithPolymorphicThisIsAssignable.ts, 3, 1)) + + constructor() { + // types of increment not compatible?? + this.test(); +>this.test : Symbol(Example.test, Decl(subclassWithPolymorphicThisIsAssignable.ts, 12, 5)) +>this : Symbol(Example, Decl(subclassWithPolymorphicThisIsAssignable.ts, 6, 45)) +>test : Symbol(Example.test, Decl(subclassWithPolymorphicThisIsAssignable.ts, 12, 5)) +>Z : Symbol(Z, Decl(subclassWithPolymorphicThisIsAssignable.ts, 8, 21)) + } + + public test() { } +>test : Symbol(Example.test, Decl(subclassWithPolymorphicThisIsAssignable.ts, 12, 5)) +>Z : Symbol(Z, Decl(subclassWithPolymorphicThisIsAssignable.ts, 14, 16)) +>Document : Symbol(Document, Decl(subclassWithPolymorphicThisIsAssignable.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.types b/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.types new file mode 100644 index 00000000000..d84570d2e0f --- /dev/null +++ b/tests/baselines/reference/subclassWithPolymorphicThisIsAssignable.types @@ -0,0 +1,35 @@ +=== tests/cases/compiler/subclassWithPolymorphicThisIsAssignable.ts === +/* taken from mongoose.Document */ +interface Document { +>Document : Document + + increment(): this; +>increment : () => this +} + +/* our custom model extends the mongoose document */ +interface CustomDocument extends Document { } +>CustomDocument : CustomDocument +>Document : Document + +export class Example { +>Example : Example +>Z : Z +>CustomDocument : CustomDocument + + constructor() { + // types of increment not compatible?? + this.test(); +>this.test() : void +>this.test : () => void +>this : this +>test : () => void +>Z : Z + } + + public test() { } +>test : () => void +>Z : Z +>Document : Document +} + diff --git a/tests/cases/compiler/collectionPatternNoError.ts b/tests/cases/compiler/collectionPatternNoError.ts new file mode 100644 index 00000000000..83fa6808d5b --- /dev/null +++ b/tests/cases/compiler/collectionPatternNoError.ts @@ -0,0 +1,36 @@ +interface MsgConstructor { + new(data: Array<{}>): T; +} +class Message { + clone(): this { + return this; + } +} +interface MessageList extends Message { + methodOnMessageList(): T[]; +} + +function fetchMsg(protoCtor: MsgConstructor): V { + return null!; +} + +class DataProvider> { + constructor( + private readonly message: MsgConstructor, + private readonly messageList: MsgConstructor, + ) { } + + fetch() { + const messageList = fetchMsg(this.messageList); + messageList.methodOnMessageList(); + } +} + +// The same bug as the above but using indexed accesses +// (won't surface directly unless unsound indexed access assignments are forbidden) +function f< + U extends {TType: MessageList}, + T extends Message +>(message: MsgConstructor, messageList: MsgConstructor) { + fetchMsg(messageList).methodOnMessageList(); +} diff --git a/tests/cases/compiler/subclassWithPolymorphicThisIsAssignable.ts b/tests/cases/compiler/subclassWithPolymorphicThisIsAssignable.ts new file mode 100644 index 00000000000..acd3ac13476 --- /dev/null +++ b/tests/cases/compiler/subclassWithPolymorphicThisIsAssignable.ts @@ -0,0 +1,16 @@ +/* taken from mongoose.Document */ +interface Document { + increment(): this; +} + +/* our custom model extends the mongoose document */ +interface CustomDocument extends Document { } + +export class Example { + constructor() { + // types of increment not compatible?? + this.test(); + } + + public test() { } +} From e6c62b9cc44405653078cd954dfe3dd9ee7a2bab Mon Sep 17 00:00:00 2001 From: csigs Date: Sat, 19 May 2018 04:10:20 +0000 Subject: [PATCH 35/40] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 3eb5854c5c0..e880c4493a9 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1017,6 +1017,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index afce2f07042..3bc6e8db18b 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -998,6 +998,15 @@ + + + + + + + + + From 3563a0576da0876d7657d1e4fc676353aeb80641 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 18 May 2018 23:44:38 -0700 Subject: [PATCH 36/40] Use single quotes around 'typeof' in message. --- src/compiler/diagnosticMessages.json | 2 +- tests/cases/fourslash/codeFixAddMissingTypeof1.ts | 2 +- tests/cases/fourslash/codeFixAddMissingTypeof2.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 078bd600771..b363fceb932 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4258,7 +4258,7 @@ "category": "Message", "code": 95051 }, - "Add missing typeof": { + "Add missing 'typeof'": { "category": "Message", "code": 95052 }, diff --git a/tests/cases/fourslash/codeFixAddMissingTypeof1.ts b/tests/cases/fourslash/codeFixAddMissingTypeof1.ts index ab728c07455..145f5b46116 100644 --- a/tests/cases/fourslash/codeFixAddMissingTypeof1.ts +++ b/tests/cases/fourslash/codeFixAddMissingTypeof1.ts @@ -7,7 +7,7 @@ //// const x: import("foo") = import("foo"); verify.codeFix({ - description: "Add missing typeof", + description: "Add missing 'typeof'", newFileContent: `declare module "foo" { const a = "foo" export = a diff --git a/tests/cases/fourslash/codeFixAddMissingTypeof2.ts b/tests/cases/fourslash/codeFixAddMissingTypeof2.ts index bb863e8db37..563cad10a57 100644 --- a/tests/cases/fourslash/codeFixAddMissingTypeof2.ts +++ b/tests/cases/fourslash/codeFixAddMissingTypeof2.ts @@ -8,6 +8,6 @@ goTo.file("b.ts") verify.codeFix({ - description: "Add missing typeof", + description: "Add missing 'typeof'", newFileContent: `const a: typeof import("./a") = import("./a")` }); From 956d82ae94a9eb84e016e80ff470c193c2a095e2 Mon Sep 17 00:00:00 2001 From: csigs Date: Sat, 19 May 2018 16:10:26 +0000 Subject: [PATCH 37/40] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 4c1b7b81a50..7a76969651e 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -1017,6 +1017,15 @@ + + + + + + + + + @@ -6573,6 +6582,12 @@ + + + + + + @@ -6612,6 +6627,12 @@ + + + + + + From c19408ba4db156d4810d77ac668a77d598d21004 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 19 May 2018 11:23:41 -0700 Subject: [PATCH 38/40] Port changes in #24238 to source file --- src/lib/es2018.regexp.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/es2018.regexp.d.ts b/src/lib/es2018.regexp.d.ts index 85e1bc909b5..2067b4846d7 100644 --- a/src/lib/es2018.regexp.d.ts +++ b/src/lib/es2018.regexp.d.ts @@ -8,4 +8,12 @@ interface RegExpExecArray { groups?: { [key: string]: string } +} + +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; } \ No newline at end of file From c09cc70ebeffdeed8d5708ddead7cefed0da710b Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 21 May 2018 07:58:33 -0700 Subject: [PATCH 39/40] Fix bug: VariableDeclaration initializer may be undefined (#24256) --- src/services/refactors/moveToNewFile.ts | 2 +- tests/cases/fourslash/moveToNewFile_moveImport.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index d0d0df4250e..11220205a48 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -76,7 +76,7 @@ namespace ts.refactor { case SyntaxKind.ImportEqualsDeclaration: return !hasModifier(node, ModifierFlags.Export); case SyntaxKind.VariableStatement: - return (node as VariableStatement).declarationList.declarations.every(d => isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true)); + return (node as VariableStatement).declarationList.declarations.every(d => d.initializer && isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true)); default: return false; } diff --git a/tests/cases/fourslash/moveToNewFile_moveImport.ts b/tests/cases/fourslash/moveToNewFile_moveImport.ts index 08a89403070..d1560e03aba 100644 --- a/tests/cases/fourslash/moveToNewFile_moveImport.ts +++ b/tests/cases/fourslash/moveToNewFile_moveImport.ts @@ -2,6 +2,7 @@ // @Filename: /a.ts ////[|import { a, b } from "m"; +////let l; ////a;|] ////b; @@ -10,8 +11,9 @@ verify.moveToNewFile({ "/a.ts": `import { b } from "m"; b;`, - "/newFile.ts": + "/l.ts": `import { a } from "m"; +let l; a;`, } }); From 440291e316ce0dfdcdd8ebcc3373f4178b887a43 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 21 May 2018 10:48:50 -0700 Subject: [PATCH 40/40] Fix bug: Get merged module symbol in forEachExternalModule (#24295) --- src/services/codefixes/importFixes.ts | 2 +- .../completionsImport_augmentation.ts | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionsImport_augmentation.ts diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index d30e2a2cf60..eaa0a7c0611 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -498,7 +498,7 @@ namespace ts.codefix { } for (const sourceFile of allSourceFiles) { if (isExternalOrCommonJsModule(sourceFile)) { - cb(sourceFile.symbol, sourceFile); + cb(checker.getMergedSymbol(sourceFile.symbol), sourceFile); } } } diff --git a/tests/cases/fourslash/completionsImport_augmentation.ts b/tests/cases/fourslash/completionsImport_augmentation.ts new file mode 100644 index 00000000000..701af24537f --- /dev/null +++ b/tests/cases/fourslash/completionsImport_augmentation.ts @@ -0,0 +1,36 @@ +/// + +// @Filename: /a.ts +////export const foo = 0; + +// @Filename: /bar.ts +////export {}; +////declare module "./a" { +//// export const bar = 0; +////} + +// @Filename: /user.ts +/////**/ + +verify.completions({ + marker: "", + includes: [ + { + name: "foo", + text: "const foo: 0", + source: "/a", + sourceDisplay: "./a", + hasAction: true, + }, + { + name: "bar", + text: "const bar: 0", + source: "/a", + sourceDisplay: "./a", + hasAction: true, + }, + ], + preferences: { + includeCompletionsForModuleExports: true, + }, +});