diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index 9b5c11d0e43e3..aabd9ac8333a5 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -5,7 +5,7 @@ namespace ts { // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - export const version: string = `${versionMajorMinor}.0`; + export const version: string = `${versionMajorMinor}.0-dev`; /** * Type of objects whose values are all of the same type. diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js index 485f94c9e18aa..9bc4bb789c561 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js @@ -169,112 +169,3 @@ export declare const d: Promise<{ cjsNonmain: true; }>; export declare const e: Promise; - - -//// [DtsFileErrors] - - -tests/cases/conformance/node/other.d.cts(4,72): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -tests/cases/conformance/node/other.d.cts(5,71): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -tests/cases/conformance/node/other2.d.cts(5,70): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - - -==== tests/cases/conformance/node/index.d.ts (0 errors) ==== - export {}; - -==== tests/cases/conformance/node/index.d.mts (0 errors) ==== - export {}; - -==== tests/cases/conformance/node/index.d.cts (0 errors) ==== - export {}; - -==== tests/cases/conformance/node/other.d.ts (0 errors) ==== - export declare const a: { - default: typeof import("package/cjs"); - }; - export declare const b: typeof import("package/mjs"); - export declare const c: typeof import("package"); - export declare const f: { - default: typeof import("inner"); - cjsMain: true; - }; - -==== tests/cases/conformance/node/other2.d.ts (0 errors) ==== - export declare const d: { - default: typeof import("inner/cjs"); - cjsNonmain: true; - }; - export declare const e: typeof import("inner/mjs"); - -==== tests/cases/conformance/node/other.d.mts (0 errors) ==== - export declare const a: { - default: typeof import("package/cjs"); - }; - export declare const b: typeof import("package/mjs"); - export declare const c: typeof import("package"); - export declare const f: { - default: typeof import("inner"); - cjsMain: true; - }; - -==== tests/cases/conformance/node/other2.d.mts (0 errors) ==== - export declare const d: { - default: typeof import("inner/cjs"); - cjsNonmain: true; - }; - export declare const e: typeof import("inner/mjs"); - -==== tests/cases/conformance/node/other.d.cts (2 errors) ==== - export declare const a: Promise<{ - default: typeof import("./index.cjs"); - }>; - export declare const b: Promise; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - export declare const c: Promise; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - export declare const f: Promise<{ - default: typeof import("inner"); - cjsMain: true; - }>; - -==== tests/cases/conformance/node/other2.d.cts (1 errors) ==== - export declare const d: Promise<{ - default: typeof import("inner/cjs"); - cjsNonmain: true; - }>; - export declare const e: Promise; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - -==== tests/cases/conformance/node/node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - export const cjsMain = true; -==== tests/cases/conformance/node/node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - export const esm = true; -==== tests/cases/conformance/node/node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - export const cjsNonmain = true; -==== tests/cases/conformance/node/package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== tests/cases/conformance/node/node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index f8e0dd250c64a..a8a76a05152b7 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt @@ -1,44 +1,26 @@ -/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js index e24fd94dba7de..1b8bc65976edc 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js @@ -30,3 +30,16 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index 7efa411b51e2a..5aaee4a285e8e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,44 +1,26 @@ -/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,50): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. -/index.ts(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. -/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js index e24fd94dba7de..1b8bc65976edc 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js @@ -30,3 +30,16 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index 60b828aa1b010..0403a6e026ffe 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,21 +1,11 @@ -/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -24,21 +14,13 @@ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js index 817fbde7e0798..fad19d466a6ac 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js @@ -34,3 +34,16 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] export {}; + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index 2667d16176820..47c2ad040c0db 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,21 +1,11 @@ -/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -24,21 +14,13 @@ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js index 817fbde7e0798..fad19d466a6ac 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js @@ -34,3 +34,16 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] export {}; + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index fa726c1dc13d7..bc3eb30565c6f 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt @@ -2,11 +2,10 @@ /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(4,39): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== /index.ts (6 errors) ==== +==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -19,8 +18,6 @@ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js index 7daaa0cda7eee..3b2af2656d08b 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js @@ -30,3 +30,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg"; +import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index 0fd8ca6399ebc..49a86cf598055 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -2,11 +2,10 @@ /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. -/index.ts(4,39): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,76): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. -==== /index.ts (6 errors) ==== +==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -19,8 +18,6 @@ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js index 7daaa0cda7eee..3b2af2656d08b 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js @@ -30,3 +30,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg"; +import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt deleted file mode 100644 index 25220b54a035c..0000000000000 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -/index.ts(2,31): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(3,31): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(5,58): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(6,58): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - - -==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt deleted file mode 100644 index 25220b54a035c..0000000000000 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -/index.ts(2,31): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(3,31): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(5,58): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -/index.ts(6,58): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - - -==== /index.ts (4 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt index d6945be0dc65b..b8b88af5ded82 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,7 +1,5 @@ /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(3,31): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,58): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'assert' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -91,21 +89,17 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt index d6945be0dc65b..b8b88af5ded82 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,7 +1,5 @@ /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(3,31): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,58): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'assert' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -91,21 +89,17 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface =