tests/cases/conformance/node/allowJs/index.cjs(2,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. tests/cases/conformance/node/allowJs/index.cjs(3,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. tests/cases/conformance/node/allowJs/index.cjs(6,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. tests/cases/conformance/node/allowJs/index.cjs(9,21): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. tests/cases/conformance/node/allowJs/index.cjs(11,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. tests/cases/conformance/node/allowJs/index.cjs(12,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. tests/cases/conformance/node/allowJs/index.cjs(15,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. tests/cases/conformance/node/allowJs/index.cjs(16,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. tests/cases/conformance/node/allowJs/index.cjs(23,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. tests/cases/conformance/node/allowJs/index.cjs(24,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. tests/cases/conformance/node/allowJs/index.cjs(25,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. tests/cases/conformance/node/allowJs/index.cjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(51,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.cjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(52,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.cjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(59,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(60,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.cjs(61,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. tests/cases/conformance/node/allowJs/index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? tests/cases/conformance/node/allowJs/index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? tests/cases/conformance/node/allowJs/index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? tests/cases/conformance/node/allowJs/index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. tests/cases/conformance/node/allowJs/index.js(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? tests/cases/conformance/node/allowJs/index.js(16,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(17,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? tests/cases/conformance/node/allowJs/index.js(19,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(20,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? tests/cases/conformance/node/allowJs/index.js(22,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(23,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.js(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.js(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. tests/cases/conformance/node/allowJs/index.js(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? tests/cases/conformance/node/allowJs/index.js(76,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(77,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? tests/cases/conformance/node/allowJs/index.js(79,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(80,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? tests/cases/conformance/node/allowJs/index.js(82,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(83,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.js(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. tests/cases/conformance/node/allowJs/index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(50,22): error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(51,22): error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.mjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(54,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(55,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(56,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(58,22): error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(59,22): error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. tests/cases/conformance/node/allowJs/index.mjs(60,22): error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. tests/cases/conformance/node/allowJs/index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. tests/cases/conformance/node/allowJs/index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? tests/cases/conformance/node/allowJs/index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. tests/cases/conformance/node/allowJs/index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? ==== tests/cases/conformance/node/allowJs/subfolder/index.js (0 errors) ==== // cjs format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder/index.cjs (0 errors) ==== // cjs format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder/index.mjs (0 errors) ==== // esm format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder2/index.js (0 errors) ==== // cjs format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder2/index.cjs (0 errors) ==== // cjs format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder2/index.mjs (0 errors) ==== // esm format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder2/another/index.js (0 errors) ==== // esm format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder2/another/index.cjs (0 errors) ==== // cjs format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/subfolder2/another/index.mjs (0 errors) ==== // esm format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/index.js (38 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; import * as m4 from "./subfolder/index.js"; import * as m5 from "./subfolder/index.mjs"; import * as m6 from "./subfolder/index.cjs"; import * as m7 from "./subfolder2/index.js"; import * as m8 from "./subfolder2/index.mjs"; import * as m9 from "./subfolder2/index.cjs"; import * as m10 from "./subfolder2/another/index.js"; import * as m11 from "./subfolder2/another/index.mjs"; import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ~~~~ !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; void m4; void m5; void m6; void m7; void m8; void m9; void m10; void m11; void m12; void m13; void m14; void m15; void m16; void m17; void m18; void m19; void m20; void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~ !!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~ !!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m27 = require("./subfolder/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m28 = require("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m29 = require("./subfolder2"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m30 = require("./subfolder2/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m31 = require("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m32 = require("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; void m27; void m28; void m29; void m30; void m31; void m32; void m33; void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/index.cjs (38 errors) ==== // ESM-format imports below should issue errors import * as m1 from "./index.js"; ~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.js")' call instead. import * as m2 from "./index.mjs"; ~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index.mjs")' call instead. import * as m3 from "./index.cjs"; import * as m4 from "./subfolder/index.js"; import * as m5 from "./subfolder/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder/index.mjs")' call instead. import * as m6 from "./subfolder/index.cjs"; import * as m7 from "./subfolder2/index.js"; import * as m8 from "./subfolder2/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/index.mjs")' call instead. import * as m9 from "./subfolder2/index.cjs"; import * as m10 from "./subfolder2/another/index.js"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.js")' call instead. import * as m11 from "./subfolder2/another/index.mjs"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index.mjs")' call instead. import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) import * as m13 from "./"; ~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./")' call instead. import * as m14 from "./index"; ~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./index")' call instead. import * as m15 from "./subfolder"; import * as m16 from "./subfolder/"; import * as m17 from "./subfolder/index"; import * as m18 from "./subfolder2"; import * as m19 from "./subfolder2/"; import * as m20 from "./subfolder2/index"; import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another")' call instead. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/")' call instead. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("./subfolder2/another/index")' call instead. void m1; void m2; void m3; void m4; void m5; void m6; void m7; void m8; void m9; void m10; void m11; void m12; void m13; void m14; void m15; void m16; void m17; void m18; void m19; void m20; void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~ !!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~ !!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m27 = require("./subfolder/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m28 = require("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m29 = require("./subfolder2"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m30 = require("./subfolder2/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m31 = require("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m32 = require("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; void m27; void m28; void m29; void m30; void m31; void m32; void m33; void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/index.mjs (38 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; import * as m4 from "./subfolder/index.js"; import * as m5 from "./subfolder/index.mjs"; import * as m6 from "./subfolder/index.cjs"; import * as m7 from "./subfolder2/index.js"; import * as m8 from "./subfolder2/index.mjs"; import * as m9 from "./subfolder2/index.cjs"; import * as m10 from "./subfolder2/another/index.js"; import * as m11 from "./subfolder2/another/index.mjs"; import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ~~~~ !!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; ~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; ~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; ~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; ~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; ~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; void m4; void m5; void m6; void m7; void m8; void m9; void m10; void m11; void m12; void m13; void m14; void m15; void m16; void m17; void m18; void m19; void m20; void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~ !!! error TS1471: Module './' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m25 = require("./index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~ !!! error TS1471: Module './index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m26 = require("./subfolder"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m27 = require("./subfolder/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m28 = require("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m29 = require("./subfolder2"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m30 = require("./subfolder2/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m31 = require("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. import m32 = require("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m33 = require("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another/' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. import m34 = require("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1471: Module './subfolder2/another/index' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead. void m24; void m25; void m26; void m27; void m28; void m29; void m30; void m31; void m32; void m33; void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ~~~~ !!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); ~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); ~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); ~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); ~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); ~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); ~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; ==== tests/cases/conformance/node/allowJs/package.json (0 errors) ==== { "name": "package", "private": true, "type": "module" } ==== tests/cases/conformance/node/allowJs/subfolder/package.json (0 errors) ==== { "type": "commonjs" } ==== tests/cases/conformance/node/allowJs/subfolder2/package.json (0 errors) ==== { } ==== tests/cases/conformance/node/allowJs/subfolder2/another/package.json (0 errors) ==== { "type": "module" }