diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3974da9930..1e495bf538e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22233,7 +22233,7 @@ namespace ts { for (const decl of indexSymbol.declarations) { const declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { - switch (declaration.parameters[0].type.kind) { + switch (declaration.parameters[0].type!.kind) { case SyntaxKind.StringKeyword: if (!seenStringIndexer) { seenStringIndexer = true; diff --git a/tests/baselines/reference/typesVersions.ambientModules.js b/tests/baselines/reference/typesVersions.ambientModules.js index 5dc00d8b376..1d7e3f04ec3 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.js +++ b/tests/baselines/reference/typesVersions.ambientModules.js @@ -6,7 +6,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } @@ -20,18 +20,18 @@ declare module "ext/other" { //// [index.d.ts] declare module "ext" { - export const a = "ts3.0 a"; + export const a = "ts3.1 a"; } declare module "ext/other" { - export const b = "ts3.0 b"; + export const b = "ts3.1 b"; } //// [main.ts] import { a } from "ext"; import { b } from "ext/other"; -const aa: "ts3.0 a" = a; -const bb: "ts3.0 b" = b; +const aa: "ts3.1 a" = a; +const bb: "ts3.1 b" = b; //// [main.js] diff --git a/tests/baselines/reference/typesVersions.ambientModules.symbols b/tests/baselines/reference/typesVersions.ambientModules.symbols index d8a0ab0f2ca..91d1adacd9c 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.symbols +++ b/tests/baselines/reference/typesVersions.ambientModules.symbols @@ -5,25 +5,25 @@ import { a } from "ext"; import { b } from "ext/other"; >b : Symbol(b, Decl(main.ts, 1, 8)) -const aa: "ts3.0 a" = a; +const aa: "ts3.1 a" = a; >aa : Symbol(aa, Decl(main.ts, 3, 5)) >a : Symbol(a, Decl(main.ts, 0, 8)) -const bb: "ts3.0 b" = b; +const bb: "ts3.1 b" = b; >bb : Symbol(bb, Decl(main.ts, 4, 5)) >b : Symbol(b, Decl(main.ts, 1, 8)) -=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts === +=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts === declare module "ext" { >"ext" : Symbol("ext", Decl(index.d.ts, 0, 0)) - export const a = "ts3.0 a"; + export const a = "ts3.1 a"; >a : Symbol(a, Decl(index.d.ts, 1, 16)) } declare module "ext/other" { >"ext/other" : Symbol("ext/other", Decl(index.d.ts, 2, 1)) - export const b = "ts3.0 b"; + export const b = "ts3.1 b"; >b : Symbol(b, Decl(index.d.ts, 4, 16)) } diff --git a/tests/baselines/reference/typesVersions.ambientModules.trace.json b/tests/baselines/reference/typesVersions.ambientModules.trace.json index f40d37bd7c3..7a442ce5048 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.trace.json +++ b/tests/baselines/reference/typesVersions.ambientModules.trace.json @@ -11,27 +11,27 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/index'.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index' does not exist.", - "Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index', target file type 'TypeScript'.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.ts' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.tsx' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'. ========", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index', target file type 'TypeScript'.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.ts' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.ts' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.tsx' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts' does not exist.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.ts' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' does not exist.", "Directory 'tests/cases/conformance/moduleResolution/node_modules/@types' does not exist, skipping all lookups in it.", "Directory 'tests/cases/conformance/node_modules' does not exist, skipping all lookups in it.", "Directory 'tests/cases/node_modules' does not exist, skipping all lookups in it.", @@ -41,11 +41,11 @@ "Loading module 'ext/other' from 'node_modules' folder, target file type 'JavaScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.js' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.jsx' does not exist.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.js' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.jsx' does not exist.", "Directory 'tests/cases/conformance/node_modules' does not exist, skipping all lookups in it.", "Directory 'tests/cases/node_modules' does not exist, skipping all lookups in it.", "Directory 'tests/node_modules' does not exist, skipping all lookups in it.", diff --git a/tests/baselines/reference/typesVersions.ambientModules.types b/tests/baselines/reference/typesVersions.ambientModules.types index 20cd4112ebe..0e81bad67a0 100644 --- a/tests/baselines/reference/typesVersions.ambientModules.types +++ b/tests/baselines/reference/typesVersions.ambientModules.types @@ -1,31 +1,31 @@ === tests/cases/conformance/moduleResolution/main.ts === import { a } from "ext"; ->a : "ts3.0 a" +>a : "ts3.1 a" import { b } from "ext/other"; ->b : "ts3.0 b" +>b : "ts3.1 b" -const aa: "ts3.0 a" = a; ->aa : "ts3.0 a" ->a : "ts3.0 a" +const aa: "ts3.1 a" = a; +>aa : "ts3.1 a" +>a : "ts3.1 a" -const bb: "ts3.0 b" = b; ->bb : "ts3.0 b" ->b : "ts3.0 b" +const bb: "ts3.1 b" = b; +>bb : "ts3.1 b" +>b : "ts3.1 b" -=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts === +=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts === declare module "ext" { >"ext" : typeof import("ext") - export const a = "ts3.0 a"; ->a : "ts3.0 a" ->"ts3.0 a" : "ts3.0 a" + export const a = "ts3.1 a"; +>a : "ts3.1 a" +>"ts3.1 a" : "ts3.1 a" } declare module "ext/other" { >"ext/other" : typeof import("ext/other") - export const b = "ts3.0 b"; ->b : "ts3.0 b" ->"ts3.0 b" : "ts3.0 b" + export const b = "ts3.1 b"; +>b : "ts3.1 b" +>"ts3.1 b" : "ts3.1 b" } diff --git a/tests/baselines/reference/typesVersions.multiFile.js b/tests/baselines/reference/typesVersions.multiFile.js index 0d3b91f7b13..14f7fd8aaf4 100644 --- a/tests/baselines/reference/typesVersions.multiFile.js +++ b/tests/baselines/reference/typesVersions.multiFile.js @@ -6,7 +6,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } @@ -17,17 +17,17 @@ export const a = "default a"; export const b = "default b"; //// [index.d.ts] -export const a = "ts3.0 a"; +export const a = "ts3.1 a"; //// [other.d.ts] -export const b = "ts3.0 b"; +export const b = "ts3.1 b"; //// [main.ts] import { a } from "ext"; import { b } from "ext/other"; -const aa: "ts3.0 a" = a; -const bb: "ts3.0 b" = b; +const aa: "ts3.1 a" = a; +const bb: "ts3.1 b" = b; //// [main.js] diff --git a/tests/baselines/reference/typesVersions.multiFile.symbols b/tests/baselines/reference/typesVersions.multiFile.symbols index c79bb054609..11ea8b7857a 100644 --- a/tests/baselines/reference/typesVersions.multiFile.symbols +++ b/tests/baselines/reference/typesVersions.multiFile.symbols @@ -6,12 +6,12 @@ export const a = "default a"; export const b = "default b"; >b : Symbol(b, Decl(other.d.ts, 0, 12)) -=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts === -export const a = "ts3.0 a"; +=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts === +export const a = "ts3.1 a"; >a : Symbol(a, Decl(index.d.ts, 0, 12)) -=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts === -export const b = "ts3.0 b"; +=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts === +export const b = "ts3.1 b"; >b : Symbol(b, Decl(other.d.ts, 0, 12)) === tests/cases/conformance/moduleResolution/main.ts === @@ -21,11 +21,11 @@ import { a } from "ext"; import { b } from "ext/other"; >b : Symbol(b, Decl(main.ts, 1, 8)) -const aa: "ts3.0 a" = a; +const aa: "ts3.1 a" = a; >aa : Symbol(aa, Decl(main.ts, 3, 5)) >a : Symbol(a, Decl(main.ts, 0, 8)) -const bb: "ts3.0 b" = b; +const bb: "ts3.1 b" = b; >bb : Symbol(bb, Decl(main.ts, 4, 5)) >b : Symbol(b, Decl(main.ts, 1, 8)) diff --git a/tests/baselines/reference/typesVersions.multiFile.trace.json b/tests/baselines/reference/typesVersions.multiFile.trace.json index 6884322c301..e7245fa5765 100644 --- a/tests/baselines/reference/typesVersions.multiFile.trace.json +++ b/tests/baselines/reference/typesVersions.multiFile.trace.json @@ -11,27 +11,27 @@ "File 'tests/cases/conformance/moduleResolution/node_modules/ext.d.ts' does not exist.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/moduleResolution/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/index'.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index' does not exist.", - "Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index', target file type 'TypeScript'.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.ts' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.tsx' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts'. ========", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index', target file type 'TypeScript'.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.ts' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.tsx' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'.", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/moduleResolution/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/moduleResolution/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.ts' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.tsx' does not exist.", - "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts'. ========" + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.ts' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.tsx' does not exist.", + "File 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts'.", + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersions.multiFile.types b/tests/baselines/reference/typesVersions.multiFile.types index c0634803d29..734a90067cb 100644 --- a/tests/baselines/reference/typesVersions.multiFile.types +++ b/tests/baselines/reference/typesVersions.multiFile.types @@ -8,28 +8,28 @@ export const b = "default b"; >b : "default b" >"default b" : "default b" -=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/index.d.ts === -export const a = "ts3.0 a"; ->a : "ts3.0 a" ->"ts3.0 a" : "ts3.0 a" +=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/index.d.ts === +export const a = "ts3.1 a"; +>a : "ts3.1 a" +>"ts3.1 a" : "ts3.1 a" -=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.0/other.d.ts === -export const b = "ts3.0 b"; ->b : "ts3.0 b" ->"ts3.0 b" : "ts3.0 b" +=== tests/cases/conformance/moduleResolution/node_modules/ext/ts3.1/other.d.ts === +export const b = "ts3.1 b"; +>b : "ts3.1 b" +>"ts3.1 b" : "ts3.1 b" === tests/cases/conformance/moduleResolution/main.ts === import { a } from "ext"; ->a : "ts3.0 a" +>a : "ts3.1 a" import { b } from "ext/other"; ->b : "ts3.0 b" +>b : "ts3.1 b" -const aa: "ts3.0 a" = a; ->aa : "ts3.0 a" ->a : "ts3.0 a" +const aa: "ts3.1 a" = a; +>aa : "ts3.1 a" +>a : "ts3.1 a" -const bb: "ts3.0 b" = b; ->bb : "ts3.0 b" ->b : "ts3.0 b" +const bb: "ts3.1 b" = b; +>bb : "ts3.1 b" +>b : "ts3.1 b" diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.js b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.js index a226df8e873..b1af852940b 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.js +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.js @@ -6,7 +6,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.symbols b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.symbols index 15d1718cce7..2e4794ba56a 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.symbols +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.symbols @@ -13,7 +13,7 @@ export const vb = fb(); >vb : Symbol(vb, Decl(main.ts, 4, 12)) >fb : Symbol(fb, Decl(main.ts, 1, 8)) -=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts === +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === declare module "ext" { >"ext" : Symbol("ext", Decl(index.d.ts, 0, 0)) diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json index f973d37cd58..c3b0e232748 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.trace.json @@ -11,27 +11,27 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/index'.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index' does not exist.", - "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index', target file type 'TypeScript'.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.ts' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.tsx' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts'. ========", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index', target file type 'TypeScript'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.ts' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.tsx' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.d.ts' does not exist.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' does not exist.", "Directory 'tests/cases/conformance/declarationEmit/node_modules/@types' does not exist, skipping all lookups in it.", "Directory 'tests/cases/conformance/node_modules' does not exist, skipping all lookups in it.", "Directory 'tests/cases/node_modules' does not exist, skipping all lookups in it.", @@ -41,11 +41,11 @@ "Loading module 'ext/other' from 'node_modules' folder, target file type 'JavaScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.js' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.jsx' does not exist.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.js' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.jsx' does not exist.", "Directory 'tests/cases/conformance/node_modules' does not exist, skipping all lookups in it.", "Directory 'tests/cases/node_modules' does not exist, skipping all lookups in it.", "Directory 'tests/node_modules' does not exist, skipping all lookups in it.", diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.types b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.types index 9f47ca9750c..3599ee312a3 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.types +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.ambient.types @@ -15,7 +15,7 @@ export const vb = fb(); >fb() : import("ext/other").B >fb : () => import("ext/other").B -=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts === +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === declare module "ext" { >"ext" : typeof import("ext") diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.js b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.js index 4a1edf5c97e..22cdb0087ef 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.js +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.js @@ -6,7 +6,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.symbols b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.symbols index e5db0491541..4449de33ded 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.symbols +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.symbols @@ -14,7 +14,7 @@ export function fb(): B; >fb : Symbol(fb, Decl(other.d.ts, 0, 21)) >B : Symbol(B, Decl(other.d.ts, 0, 0)) -=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts === +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === export interface A {} >A : Symbol(A, Decl(index.d.ts, 0, 0)) @@ -22,7 +22,7 @@ export function fa(): A; >fa : Symbol(fa, Decl(index.d.ts, 0, 21)) >A : Symbol(A, Decl(index.d.ts, 0, 0)) -=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.d.ts === +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts === export interface B {} >B : Symbol(B, Decl(other.d.ts, 0, 0)) diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json index 0296a58b896..532e80feac7 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.trace.json @@ -11,27 +11,27 @@ "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", "'package.json' does not have a 'typings' field.", "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", "Module name 'index', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/index'.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index' does not exist.", - "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index', target file type 'TypeScript'.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.ts' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.tsx' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts'.", - "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts'. ========", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index', target file type 'TypeScript'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", "'package.json' has a 'typesVersions' field with version-specific path mappings.", "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", - "'package.json' has a 'typesVersions' entry '3.0' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", "Module name 'other', matched pattern '*'.", - "Trying substitution 'ts3.0/*', candidate module location: 'ts3.0/other'.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.ts' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.tsx' does not exist.", - "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.d.ts' exist - use it as a name resolution result.", - "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.d.ts'.", - "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.d.ts'. ========" + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'.", + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.types b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.types index 73721bafec1..9f9dd015942 100644 --- a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.types +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFile.types @@ -8,30 +8,30 @@ export interface B {} export function fb(): B; >fb : () => B -=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index.d.ts === +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === export interface A {} export function fa(): A; >fa : () => A -=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other.d.ts === +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts === export interface B {} export function fb(): B; >fb : () => B === tests/cases/conformance/declarationEmit/main.ts === import { fa } from "ext"; ->fa : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index").A +>fa : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index").A import { fb } from "ext/other"; ->fb : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other").B +>fb : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other").B export const va = fa(); ->va : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index").A ->fa() : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index").A ->fa : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/index").A +>va : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index").A +>fa() : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index").A +>fa : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index").A export const vb = fb(); ->vb : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other").B ->fb() : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other").B ->fb : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.0/other").B +>vb : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other").B +>fb() : import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other").B +>fb : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other").B diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.errors.txt b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.errors.txt new file mode 100644 index 00000000000..66624634d9f --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/declarationEmit/main.ts(1,10): error TS2305: Module '"tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index"' has no exported member 'fa'. + + +==== tests/cases/conformance/declarationEmit/tsconfig.json (0 errors) ==== + {} +==== tests/cases/conformance/declarationEmit/node_modules/ext/package.json (0 errors) ==== + { + "name": "ext", + "version": "1.0.0", + "types": "index", + "typesVersions": { + "3.1": { "*" : ["ts3.1/*"] } + } + } + +==== tests/cases/conformance/declarationEmit/node_modules/ext/index.d.ts (0 errors) ==== + export interface A {} + export function fa(): A; + +==== tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts (0 errors) ==== + export interface B {} + export function fb(): B; + +==== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts (0 errors) ==== + export * from "../"; + +==== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts (0 errors) ==== + export * from "../other"; + +==== tests/cases/conformance/declarationEmit/main.ts (1 errors) ==== + import { fa } from "ext"; + ~~ +!!! error TS2305: Module '"tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index"' has no exported member 'fa'. + import { fb } from "ext/other"; + + export const va = fa(); + export const vb = fb(); + \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.js b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.js new file mode 100644 index 00000000000..c7b885d5e9e --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.js @@ -0,0 +1,46 @@ +//// [tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.ts] //// + +//// [package.json] +{ + "name": "ext", + "version": "1.0.0", + "types": "index", + "typesVersions": { + "3.1": { "*" : ["ts3.1/*"] } + } +} + +//// [index.d.ts] +export interface A {} +export function fa(): A; + +//// [other.d.ts] +export interface B {} +export function fb(): B; + +//// [index.d.ts] +export * from "../"; + +//// [other.d.ts] +export * from "../other"; + +//// [main.ts] +import { fa } from "ext"; +import { fb } from "ext/other"; + +export const va = fa(); +export const vb = fb(); + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ext_1 = require("ext"); +const other_1 = require("ext/other"); +exports.va = ext_1.fa(); +exports.vb = other_1.fb(); + + +//// [main.d.ts] +export declare const va: any; +export declare const vb: import("ext/other").B; diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.symbols b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.symbols new file mode 100644 index 00000000000..a3367579265 --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.symbols @@ -0,0 +1,37 @@ +=== tests/cases/conformance/declarationEmit/node_modules/ext/index.d.ts === +export interface A {} +>A : Symbol(A, Decl(index.d.ts, 0, 0)) + +export function fa(): A; +>fa : Symbol(fa, Decl(index.d.ts, 0, 21)) +>A : Symbol(A, Decl(index.d.ts, 0, 0)) + +=== tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts === +export interface B {} +>B : Symbol(B, Decl(other.d.ts, 0, 0)) + +export function fb(): B; +>fb : Symbol(fb, Decl(other.d.ts, 0, 21)) +>B : Symbol(B, Decl(other.d.ts, 0, 0)) + +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === +export * from "../"; +No type information for this code. +No type information for this code.=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts === +export * from "../other"; +No type information for this code. +No type information for this code.=== tests/cases/conformance/declarationEmit/main.ts === +import { fa } from "ext"; +>fa : Symbol(fa, Decl(main.ts, 0, 8)) + +import { fb } from "ext/other"; +>fb : Symbol(fb, Decl(main.ts, 1, 8)) + +export const va = fa(); +>va : Symbol(va, Decl(main.ts, 3, 12)) +>fa : Symbol(fa, Decl(main.ts, 0, 8)) + +export const vb = fb(); +>vb : Symbol(vb, Decl(main.ts, 4, 12)) +>fb : Symbol(fb, Decl(main.ts, 1, 8)) + diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json new file mode 100644 index 00000000000..33d5a0e3177 --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.trace.json @@ -0,0 +1,65 @@ +[ + "======== Resolving module '../' from 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/', target file type 'TypeScript'.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/ndex/index.d.ts@1.0.0'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", + "Module name 'index', matched pattern '*'.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index', target file type 'TypeScript'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "======== Module name '../' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Resolving module '../other' from 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/other', target file type 'TypeScript'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other.d.ts@1.0.0'.", + "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'. ========", + "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", + "Module name 'index', matched pattern '*'.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/index'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index', target file type 'TypeScript'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "Module name 'other', matched pattern '*'.", + "Trying substitution 'ts3.1/*', candidate module location: 'ts3.1/other'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'.", + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.types b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.types new file mode 100644 index 00000000000..05800e1d35d --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/declarationEmit/node_modules/ext/index.d.ts === +export interface A {} +export function fa(): A; +>fa : () => A + +=== tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts === +export interface B {} +export function fb(): B; +>fb : () => B + +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === +export * from "../"; +No type information for this code. +No type information for this code.=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/other.d.ts === +export * from "../other"; +No type information for this code. +No type information for this code.=== tests/cases/conformance/declarationEmit/main.ts === +import { fa } from "ext"; +>fa : any + +import { fb } from "ext/other"; +>fb : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/other").B + +export const va = fa(); +>va : any +>fa() : any +>fa : any + +export const vb = fb(); +>vb : import("tests/cases/conformance/declarationEmit/node_modules/ext/other").B +>fb() : import("tests/cases/conformance/declarationEmit/node_modules/ext/other").B +>fb : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/other").B + diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.js b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.js new file mode 100644 index 00000000000..86a621161f6 --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.ts] //// + +//// [package.json] +{ + "name": "ext", + "version": "1.0.0", + "types": "index", + "typesVersions": { + "3.1": { + "index" : ["ts3.1/index"] + } + } +} + +//// [index.d.ts] +export interface A {} +export function fa(): A; + +//// [other.d.ts] +export interface A2 {} +export function fa(): A2; + +//// [index.d.ts] +export * from "../other"; + +//// [main.ts] +import { fa } from "ext"; +import { fa as fa2 } from "ext/other"; + +export const va = fa(); +export const va2 = fa2(); + + +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ext_1 = require("ext"); +const other_1 = require("ext/other"); +exports.va = ext_1.fa(); +exports.va2 = other_1.fa(); + + +//// [main.d.ts] +export declare const va: import("ext/other").A2; +export declare const va2: import("ext/other").A2; diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.symbols b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.symbols new file mode 100644 index 00000000000..892e521994b --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/declarationEmit/node_modules/ext/index.d.ts === +export interface A {} +>A : Symbol(A, Decl(index.d.ts, 0, 0)) + +export function fa(): A; +>fa : Symbol(fa, Decl(index.d.ts, 0, 21)) +>A : Symbol(A, Decl(index.d.ts, 0, 0)) + +=== tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts === +export interface A2 {} +>A2 : Symbol(A2, Decl(other.d.ts, 0, 0)) + +export function fa(): A2; +>fa : Symbol(fa, Decl(other.d.ts, 0, 22)) +>A2 : Symbol(A2, Decl(other.d.ts, 0, 0)) + +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === +export * from "../other"; +No type information for this code. +No type information for this code.=== tests/cases/conformance/declarationEmit/main.ts === +import { fa } from "ext"; +>fa : Symbol(fa, Decl(main.ts, 0, 8)) + +import { fa as fa2 } from "ext/other"; +>fa : Symbol(fa2, Decl(main.ts, 1, 8)) +>fa2 : Symbol(fa2, Decl(main.ts, 1, 8)) + +export const va = fa(); +>va : Symbol(va, Decl(main.ts, 3, 12)) +>fa : Symbol(fa, Decl(main.ts, 0, 8)) + +export const va2 = fa2(); +>va2 : Symbol(va2, Decl(main.ts, 4, 12)) +>fa2 : Symbol(fa2, Decl(main.ts, 1, 8)) + diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json new file mode 100644 index 00000000000..d31c0730fd9 --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.trace.json @@ -0,0 +1,44 @@ +[ + "======== Resolving module '../other' from 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/other', target file type 'TypeScript'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other.d.ts@1.0.0'.", + "======== Module name '../other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'. ========", + "======== Resolving module 'ext' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module 'ext' from 'node_modules' folder, target file type 'TypeScript'.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/index.d.ts@1.0.0'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext.d.ts' does not exist.", + "'package.json' does not have a 'typings' field.", + "'package.json' has 'types' field 'index' that references 'tests/cases/conformance/declarationEmit/node_modules/ext/index'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'index'.", + "Module name 'index', matched pattern 'index'.", + "Trying substitution 'ts3.1/index', candidate module location: 'ts3.1/index'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index' does not exist.", + "Loading module as file / folder, candidate module location 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index', target file type 'TypeScript'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'.", + "======== Module name 'ext' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts'. ========", + "======== Resolving module 'ext/other' from 'tests/cases/conformance/declarationEmit/main.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module 'ext/other' from 'node_modules' folder, target file type 'TypeScript'.", + "'package.json' has a 'typesVersions' field with version-specific path mappings.", + "Found 'package.json' at 'tests/cases/conformance/declarationEmit/node_modules/ext/package.json'. Package ID is 'ext/other/index.d.ts@1.0.0'.", + "'package.json' has a 'typesVersions' entry '3.1' that matches compiler version '3.1', looking for a pattern to match module name 'other'.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.ts' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.tsx' does not exist.", + "File 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts' exist - use it as a name resolution result.", + "Resolving real path for 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts', result 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'.", + "======== Module name 'ext/other' was successfully resolved to 'tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.types b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.types new file mode 100644 index 00000000000..d2918314133 --- /dev/null +++ b/tests/baselines/reference/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/declarationEmit/node_modules/ext/index.d.ts === +export interface A {} +export function fa(): A; +>fa : () => A + +=== tests/cases/conformance/declarationEmit/node_modules/ext/other.d.ts === +export interface A2 {} +export function fa(): A2; +>fa : () => A2 + +=== tests/cases/conformance/declarationEmit/node_modules/ext/ts3.1/index.d.ts === +export * from "../other"; +No type information for this code. +No type information for this code.=== tests/cases/conformance/declarationEmit/main.ts === +import { fa } from "ext"; +>fa : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 + +import { fa as fa2 } from "ext/other"; +>fa : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 +>fa2 : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 + +export const va = fa(); +>va : import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 +>fa() : import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 +>fa : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 + +export const va2 = fa2(); +>va2 : import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 +>fa2() : import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 +>fa2 : () => import("tests/cases/conformance/declarationEmit/node_modules/ext/other").A2 + diff --git a/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.ambient.ts b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.ambient.ts index 27bba8e830e..447f3aaa82a 100644 --- a/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.ambient.ts +++ b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.ambient.ts @@ -9,7 +9,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } @@ -22,7 +22,7 @@ declare module "ext/other" { export interface B {} export function fb(): B; } -// @filename: node_modules/ext/ts3.0/index.d.ts +// @filename: node_modules/ext/ts3.1/index.d.ts declare module "ext" { export interface A {} export function fa(): A; diff --git a/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFile.ts b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFile.ts index dd71b9b13e2..57ae6c1d631 100644 --- a/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFile.ts +++ b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFile.ts @@ -8,7 +8,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } @@ -20,11 +20,11 @@ export function fa(): A; export interface B {} export function fb(): B; -// @filename: node_modules/ext/ts3.0/index.d.ts +// @filename: node_modules/ext/ts3.1/index.d.ts export interface A {} export function fa(): A; -// @filename: node_modules/ext/ts3.0/other.d.ts +// @filename: node_modules/ext/ts3.1/other.d.ts export interface B {} export function fb(): B; diff --git a/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.ts b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.ts new file mode 100644 index 00000000000..3391361225d --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToSelf.ts @@ -0,0 +1,37 @@ +// @traceResolution: true +// @target: esnext +// @module: commonjs +// @declaration: true +// @filename: node_modules/ext/package.json +{ + "name": "ext", + "version": "1.0.0", + "types": "index", + "typesVersions": { + "3.1": { "*" : ["ts3.1/*"] } + } +} + +// @filename: node_modules/ext/index.d.ts +export interface A {} +export function fa(): A; + +// @filename: node_modules/ext/other.d.ts +export interface B {} +export function fb(): B; + +// @filename: node_modules/ext/ts3.1/index.d.ts +export * from "../"; + +// @filename: node_modules/ext/ts3.1/other.d.ts +export * from "../other"; + +// @filename: main.ts +import { fa } from "ext"; +import { fb } from "ext/other"; + +export const va = fa(); +export const vb = fb(); + +// @filename: tsconfig.json +{} \ No newline at end of file diff --git a/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.ts b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.ts new file mode 100644 index 00000000000..15072d2a7ed --- /dev/null +++ b/tests/cases/conformance/declarationEmit/typesVersionsDeclarationEmit.multiFileBackReferenceToUnmapped.ts @@ -0,0 +1,36 @@ +// @traceResolution: true +// @target: esnext +// @module: commonjs +// @declaration: true +// @filename: node_modules/ext/package.json +{ + "name": "ext", + "version": "1.0.0", + "types": "index", + "typesVersions": { + "3.1": { + "index" : ["ts3.1/index"] + } + } +} + +// @filename: node_modules/ext/index.d.ts +export interface A {} +export function fa(): A; + +// @filename: node_modules/ext/other.d.ts +export interface A2 {} +export function fa(): A2; + +// @filename: node_modules/ext/ts3.1/index.d.ts +export * from "../other"; + +// @filename: main.ts +import { fa } from "ext"; +import { fa as fa2 } from "ext/other"; + +export const va = fa(); +export const va2 = fa2(); + +// @filename: tsconfig.json +{} \ No newline at end of file diff --git a/tests/cases/conformance/moduleResolution/typesVersions.ambientModules.ts b/tests/cases/conformance/moduleResolution/typesVersions.ambientModules.ts index ac314e0c313..2de5f470473 100644 --- a/tests/cases/conformance/moduleResolution/typesVersions.ambientModules.ts +++ b/tests/cases/conformance/moduleResolution/typesVersions.ambientModules.ts @@ -8,7 +8,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } @@ -20,20 +20,20 @@ declare module "ext/other" { export const b = "default b"; } -// @filename: node_modules/ext/ts3.0/index.d.ts +// @filename: node_modules/ext/ts3.1/index.d.ts declare module "ext" { - export const a = "ts3.0 a"; + export const a = "ts3.1 a"; } declare module "ext/other" { - export const b = "ts3.0 b"; + export const b = "ts3.1 b"; } // @filename: main.ts import { a } from "ext"; import { b } from "ext/other"; -const aa: "ts3.0 a" = a; -const bb: "ts3.0 b" = b; +const aa: "ts3.1 a" = a; +const bb: "ts3.1 b" = b; // @filename: tsconfig.json {} \ No newline at end of file diff --git a/tests/cases/conformance/moduleResolution/typesVersions.multiFile.ts b/tests/cases/conformance/moduleResolution/typesVersions.multiFile.ts index c9001ca2219..8d57630af21 100644 --- a/tests/cases/conformance/moduleResolution/typesVersions.multiFile.ts +++ b/tests/cases/conformance/moduleResolution/typesVersions.multiFile.ts @@ -7,7 +7,7 @@ "version": "1.0.0", "types": "index", "typesVersions": { - "3.0": { "*" : ["ts3.0/*"] } + "3.1": { "*" : ["ts3.1/*"] } } } @@ -17,18 +17,18 @@ export const a = "default a"; // @filename: node_modules/ext/other.d.ts export const b = "default b"; -// @filename: node_modules/ext/ts3.0/index.d.ts -export const a = "ts3.0 a"; +// @filename: node_modules/ext/ts3.1/index.d.ts +export const a = "ts3.1 a"; -// @filename: node_modules/ext/ts3.0/other.d.ts -export const b = "ts3.0 b"; +// @filename: node_modules/ext/ts3.1/other.d.ts +export const b = "ts3.1 b"; // @filename: main.ts import { a } from "ext"; import { b } from "ext/other"; -const aa: "ts3.0 a" = a; -const bb: "ts3.0 b" = b; +const aa: "ts3.1 a" = a; +const bb: "ts3.1 b" = b; // @filename: tsconfig.json {} \ No newline at end of file