diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 56ced9ad94944..13693e3660dbf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4568,9 +4568,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) { - const importOrExport = findAncestor(location, isImportDeclaration)?.importClause || + const importOrExport = findAncestor(location, isImportDeclaration) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration)); - if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) { + if (errorNode && importOrExport && !(isImportDeclaration(importOrExport) ? importOrExport.importClause : importOrExport)?.isTypeOnly || findAncestor(location, isImportCall)) { error( errorNode, Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead, @@ -4579,9 +4579,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) { - const importOrExport = findAncestor(location, isImportDeclaration)?.importClause || + const importOrExport = findAncestor(location, isImportDeclaration) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration)); - if (errorNode && !(importOrExport?.isTypeOnly || findAncestor(location, isImportTypeNode))) { + if (errorNode && !(importOrExport && (isImportDeclaration(importOrExport) ? importOrExport.importClause : importOrExport)?.isTypeOnly || findAncestor(location, isImportTypeNode))) { const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference)); error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension); } diff --git a/src/testRunner/unittests/programApi.ts b/src/testRunner/unittests/programApi.ts index 44f391b869002..b7de742ba6a89 100644 --- a/src/testRunner/unittests/programApi.ts +++ b/src/testRunner/unittests/programApi.ts @@ -216,14 +216,17 @@ describe("unittests:: programApi:: Program.getTypeChecker / Program.getSemanticD const sourceFile = program.getSourceFile("main.ts")!; const typeChecker = program.getTypeChecker(); typeChecker.getSymbolAtLocation((sourceFile.statements[0] as ts.ImportDeclaration).moduleSpecifier); - assert.isEmpty(program.getSemanticDiagnostics()); + const diagnostics = program.getSemanticDiagnostics() + assert.equal(diagnostics.length, 1); + assert.equal(diagnostics[0].code, ts.Diagnostics.File_0_is_not_a_module.code); + assert.equal(diagnostics[0].messageText, "File '/module.d.ts' is not a module."); }); }); describe("unittests:: programApi:: CompilerOptions relative paths", () => { it("resolves relative paths by getCurrentDirectory", () => { const main = new documents.TextDocument("/main.ts", 'import "module";'); - const mod = new documents.TextDocument("/lib/module.ts", "declare const foo: any;"); + const mod = new documents.TextDocument("/lib/module.ts", "export declare const foo: any;"); const fs = vfs.createFromFileSystem(Harness.IO, /*ignoreCase*/ false, { documents: [main, mod], cwd: "/" }); const program = ts.createProgram(["./main.ts"], { diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 600a45563b4a8..1c191f84644af 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -2129,7 +2129,7 @@ import { x } from "../b";`, sys: () => { const module1: File = { path: `/user/username/projects/myproject/a.ts`, - content: ``, + content: `export {};`, }; const module2: File = { path: `/user/username/projects/myproject/b.ts`, diff --git a/tests/baselines/reference/allowsImportingTsExtension.errors.txt b/tests/baselines/reference/allowsImportingTsExtension.errors.txt index d66055353d5da..45954b42e863e 100644 --- a/tests/baselines/reference/allowsImportingTsExtension.errors.txt +++ b/tests/baselines/reference/allowsImportingTsExtension.errors.txt @@ -1,9 +1,11 @@ b.ts(2,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. -b.ts(3,30): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. -b.ts(5,25): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +b.ts(3,8): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +b.ts(4,30): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +b.ts(6,25): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. c.ts(2,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? -c.ts(3,30): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? -c.ts(5,25): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? +c.ts(3,8): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? +c.ts(4,30): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? +c.ts(6,25): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? ==== a.ts (0 errors) ==== @@ -12,10 +14,13 @@ c.ts(5,25): error TS2846: A declaration file cannot be imported without 'import ==== a.d.ts (0 errors) ==== export class A {} -==== b.ts (3 errors) ==== +==== b.ts (4 errors) ==== import type { A } from "./a.ts"; // ok import {} from "./a.ts"; // error ~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + import "./a.ts"; // error + ~~~~~~~~ !!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. import { type A as _A } from "./a.ts"; // error ~~~~~~~~ @@ -25,10 +30,13 @@ c.ts(5,25): error TS2846: A declaration file cannot be imported without 'import ~~~~~~~~ !!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. -==== c.ts (3 errors) ==== +==== c.ts (4 errors) ==== import type { A } from "./a.d.ts"; // ok import {} from "./a.d.ts"; // error ~~~~~~~~~~ +!!! error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? + import "./a.d.ts"; // error + ~~~~~~~~~~ !!! error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './a.js' instead? import { type A as _A } from "./a.d.ts"; // error ~~~~~~~~~~ diff --git a/tests/baselines/reference/allowsImportingTsExtension.js b/tests/baselines/reference/allowsImportingTsExtension.js index 1eab22395c687..2141ec4434ff6 100644 --- a/tests/baselines/reference/allowsImportingTsExtension.js +++ b/tests/baselines/reference/allowsImportingTsExtension.js @@ -9,6 +9,7 @@ export class A {} //// [b.ts] import type { A } from "./a.ts"; // ok import {} from "./a.ts"; // error +import "./a.ts"; // error import { type A as _A } from "./a.ts"; // error type __A = import("./a.ts").A; // ok const aPromise = import("./a.ts"); // error @@ -16,6 +17,7 @@ const aPromise = import("./a.ts"); // error //// [c.ts] import type { A } from "./a.d.ts"; // ok import {} from "./a.d.ts"; // error +import "./a.d.ts"; // error import { type A as _A } from "./a.d.ts"; // error type __A = import("./a.d.ts").A; // ok const aPromise = import("./a.d.ts"); // error @@ -25,8 +27,8 @@ const aPromise = import("./a.d.ts"); // error export class A { } //// [b.js] +import "./a.ts"; // error const aPromise = import("./a.ts"); // error -export {}; //// [c.js] +import "./a.d.ts"; // error const aPromise = import("./a.d.ts"); // error -export {}; diff --git a/tests/baselines/reference/allowsImportingTsExtension.symbols b/tests/baselines/reference/allowsImportingTsExtension.symbols index a08e00fcf5407..caca7d76b6adb 100644 --- a/tests/baselines/reference/allowsImportingTsExtension.symbols +++ b/tests/baselines/reference/allowsImportingTsExtension.symbols @@ -13,16 +13,17 @@ import type { A } from "./a.ts"; // ok >A : Symbol(A, Decl(b.ts, 0, 13)) import {} from "./a.ts"; // error +import "./a.ts"; // error import { type A as _A } from "./a.ts"; // error >A : Symbol(A, Decl(a.ts, 0, 0)) ->_A : Symbol(_A, Decl(b.ts, 2, 8)) +>_A : Symbol(_A, Decl(b.ts, 3, 8)) type __A = import("./a.ts").A; // ok ->__A : Symbol(__A, Decl(b.ts, 2, 38)) +>__A : Symbol(__A, Decl(b.ts, 3, 38)) >A : Symbol(A, Decl(a.ts, 0, 0)) const aPromise = import("./a.ts"); // error ->aPromise : Symbol(aPromise, Decl(b.ts, 4, 5)) +>aPromise : Symbol(aPromise, Decl(b.ts, 5, 5)) >"./a.ts" : Symbol("a", Decl(a.ts, 0, 0)) === c.ts === @@ -30,15 +31,16 @@ import type { A } from "./a.d.ts"; // ok >A : Symbol(A, Decl(c.ts, 0, 13)) import {} from "./a.d.ts"; // error +import "./a.d.ts"; // error import { type A as _A } from "./a.d.ts"; // error >A : Symbol(A, Decl(a.ts, 0, 0)) ->_A : Symbol(_A, Decl(c.ts, 2, 8)) +>_A : Symbol(_A, Decl(c.ts, 3, 8)) type __A = import("./a.d.ts").A; // ok ->__A : Symbol(__A, Decl(c.ts, 2, 40)) +>__A : Symbol(__A, Decl(c.ts, 3, 40)) >A : Symbol(A, Decl(a.ts, 0, 0)) const aPromise = import("./a.d.ts"); // error ->aPromise : Symbol(aPromise, Decl(c.ts, 4, 5)) +>aPromise : Symbol(aPromise, Decl(c.ts, 5, 5)) >"./a.d.ts" : Symbol("a", Decl(a.ts, 0, 0)) diff --git a/tests/baselines/reference/allowsImportingTsExtension.types b/tests/baselines/reference/allowsImportingTsExtension.types index c1fe54623e545..c8ca0133a1267 100644 --- a/tests/baselines/reference/allowsImportingTsExtension.types +++ b/tests/baselines/reference/allowsImportingTsExtension.types @@ -16,6 +16,7 @@ import type { A } from "./a.ts"; // ok > : ^ import {} from "./a.ts"; // error +import "./a.ts"; // error import { type A as _A } from "./a.ts"; // error >A : typeof A > : ^^^^^^^^ @@ -40,6 +41,7 @@ import type { A } from "./a.d.ts"; // ok > : ^ import {} from "./a.d.ts"; // error +import "./a.d.ts"; // error import { type A as _A } from "./a.d.ts"; // error >A : typeof A > : ^^^^^^^^ diff --git a/tests/baselines/reference/ambientExportDefaultErrors.errors.txt b/tests/baselines/reference/ambientExportDefaultErrors.errors.txt index 4b31677c11549..c4d3781b9e4c7 100644 --- a/tests/baselines/reference/ambientExportDefaultErrors.errors.txt +++ b/tests/baselines/reference/ambientExportDefaultErrors.errors.txt @@ -1,16 +1,22 @@ +consumer.ts(4,8): error TS2307: Cannot find module 'foo' or its corresponding type declarations. +consumer.ts(6,8): error TS2307: Cannot find module 'foo2' or its corresponding type declarations. foo.d.ts(1,16): error TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context. foo2.d.ts(1,10): error TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context. indirection.d.ts(3,20): error TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context. indirection2.d.ts(3,14): error TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context. -==== consumer.ts (0 errors) ==== +==== consumer.ts (2 errors) ==== /// /// import "indirect"; import "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo' or its corresponding type declarations. import "indirect2"; import "foo2"; + ~~~~~~ +!!! error TS2307: Cannot find module 'foo2' or its corresponding type declarations. ==== foo.d.ts (1 errors) ==== export default 2 + 2; ~~~~~ diff --git a/tests/baselines/reference/amdDependencyCommentName4.errors.txt b/tests/baselines/reference/amdDependencyCommentName4.errors.txt index 6788d6c3b3286..ead5e629fa4a8 100644 --- a/tests/baselines/reference/amdDependencyCommentName4.errors.txt +++ b/tests/baselines/reference/amdDependencyCommentName4.errors.txt @@ -1,16 +1,20 @@ +amdDependencyCommentName4.ts(6,8): error TS2792: Cannot find module 'unaliasedModule1'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? amdDependencyCommentName4.ts(8,21): error TS2792: Cannot find module 'aliasedModule1'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? amdDependencyCommentName4.ts(11,26): error TS2792: Cannot find module 'aliasedModule2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? amdDependencyCommentName4.ts(14,15): error TS2792: Cannot find module 'aliasedModule3'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? amdDependencyCommentName4.ts(17,21): error TS2792: Cannot find module 'aliasedModule4'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +amdDependencyCommentName4.ts(20,8): error TS2792: Cannot find module 'unaliasedModule2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -==== amdDependencyCommentName4.ts (4 errors) ==== +==== amdDependencyCommentName4.ts (6 errors) ==== /// /// /// /// import "unaliasedModule1"; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'unaliasedModule1'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import r1 = require("aliasedModule1"); ~~~~~~~~~~~~~~~~ @@ -32,4 +36,6 @@ amdDependencyCommentName4.ts(17,21): error TS2792: Cannot find module 'aliasedMo !!! error TS2792: Cannot find module 'aliasedModule4'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? ns; - import "unaliasedModule2"; \ No newline at end of file + import "unaliasedModule2"; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2792: Cannot find module 'unaliasedModule2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? \ No newline at end of file diff --git a/tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt b/tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt index d9b841ee69892..4ab0938a6a6b6 100644 --- a/tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt +++ b/tests/baselines/reference/autoAccessorDisallowedModifiers.errors.txt @@ -23,6 +23,7 @@ autoAccessorDisallowedModifiers.ts(31,1): error TS1275: 'accessor' modifier can autoAccessorDisallowedModifiers.ts(32,1): error TS1275: 'accessor' modifier can only appear on a property declaration. autoAccessorDisallowedModifiers.ts(33,1): error TS1275: 'accessor' modifier can only appear on a property declaration. autoAccessorDisallowedModifiers.ts(34,1): error TS1275: 'accessor' modifier can only appear on a property declaration. +autoAccessorDisallowedModifiers.ts(34,17): error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? autoAccessorDisallowedModifiers.ts(35,1): error TS1275: 'accessor' modifier can only appear on a property declaration. autoAccessorDisallowedModifiers.ts(35,25): error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? autoAccessorDisallowedModifiers.ts(36,1): error TS1275: 'accessor' modifier can only appear on a property declaration. @@ -30,7 +31,7 @@ autoAccessorDisallowedModifiers.ts(37,1): error TS1275: 'accessor' modifier can autoAccessorDisallowedModifiers.ts(38,1): error TS1275: 'accessor' modifier can only appear on a property declaration. -==== autoAccessorDisallowedModifiers.ts (30 errors) ==== +==== autoAccessorDisallowedModifiers.ts (31 errors) ==== abstract class C1 { accessor accessor a: any; ~~~~~~~~ @@ -115,6 +116,8 @@ autoAccessorDisallowedModifiers.ts(38,1): error TS1275: 'accessor' modifier can accessor import "x"; ~~~~~~~~ !!! error TS1275: 'accessor' modifier can only appear on a property declaration. + ~~~ +!!! error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? accessor import {} from "x"; ~~~~~~~~ !!! error TS1275: 'accessor' modifier can only appear on a property declaration. diff --git a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt index 805191bcca68f..0ef83f725cd47 100644 --- a/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt +++ b/tests/baselines/reference/checkExportsObjectAssignPrototypeProperty.errors.txt @@ -1,3 +1,4 @@ +validator.ts(1,8): error TS2307: Cannot find module './' or its corresponding type declarations. validator.ts(19,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. validator.ts(20,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. validator.ts(21,1): error TS2322: Type 'string' is not assignable to type 'number'. @@ -5,8 +6,10 @@ validator.ts(22,1): error TS2322: Type 'string' is not assignable to type 'numbe validator.ts(23,1): error TS2322: Type 'number' is not assignable to type 'string'. -==== validator.ts (5 errors) ==== +==== validator.ts (6 errors) ==== import "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import Person = require("./mod1"); diff --git a/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.errors.txt b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.errors.txt new file mode 100644 index 0000000000000..cff1519cb0c69 --- /dev/null +++ b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.errors.txt @@ -0,0 +1,10 @@ +es6ImportWithoutFromClauseInEs5_1.ts(1,8): error TS2307: Cannot find module 'es6ImportWithoutFromClauseInEs5_0' or its corresponding type declarations. + + +==== es6ImportWithoutFromClauseInEs5_0.ts (0 errors) ==== + export var a = 10; + +==== es6ImportWithoutFromClauseInEs5_1.ts (1 errors) ==== + import "es6ImportWithoutFromClauseInEs5_0"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'es6ImportWithoutFromClauseInEs5_0' or its corresponding type declarations. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportWithoutFromClauseWithExport.errors.txt b/tests/baselines/reference/es6ImportWithoutFromClauseWithExport.errors.txt index d40a9dee7f283..3eb75fd0443bc 100644 --- a/tests/baselines/reference/es6ImportWithoutFromClauseWithExport.errors.txt +++ b/tests/baselines/reference/es6ImportWithoutFromClauseWithExport.errors.txt @@ -1,10 +1,13 @@ client.ts(1,1): error TS1191: An import declaration cannot have modifiers. +client.ts(1,15): error TS2307: Cannot find module 'server' or its corresponding type declarations. ==== server.ts (0 errors) ==== export var a = 10; -==== client.ts (1 errors) ==== +==== client.ts (2 errors) ==== export import "server"; ~~~~~~ -!!! error TS1191: An import declaration cannot have modifiers. \ No newline at end of file +!!! error TS1191: An import declaration cannot have modifiers. + ~~~~~~~~ +!!! error TS2307: Cannot find module 'server' or its corresponding type declarations. \ No newline at end of file diff --git a/tests/baselines/reference/extendGlobalThis.errors.txt b/tests/baselines/reference/extendGlobalThis.errors.txt new file mode 100644 index 0000000000000..093beeb459cac --- /dev/null +++ b/tests/baselines/reference/extendGlobalThis.errors.txt @@ -0,0 +1,20 @@ +index.ts(1,8): error TS2307: Cannot find module './extention' or its corresponding type declarations. + + +==== extension.d.ts (0 errors) ==== + declare global { + namespace globalThis { + var test: string; + } + } + + export {} + +==== index.ts (1 errors) ==== + import "./extention"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './extention' or its corresponding type declarations. + + globalThis.tests = "a-b"; + console.log(globalThis.test.split("-")); + \ No newline at end of file diff --git a/tests/baselines/reference/extendGlobalThis.types b/tests/baselines/reference/extendGlobalThis.types index 499b561819e53..a3b91ff95e015 100644 --- a/tests/baselines/reference/extendGlobalThis.types +++ b/tests/baselines/reference/extendGlobalThis.types @@ -24,6 +24,7 @@ globalThis.tests = "a-b"; >globalThis.tests = "a-b" : "a-b" > : ^^^^^ >globalThis.tests : any +> : ^^^ >globalThis : typeof globalThis > : ^^^^^^^^^^^^^^^^^ >tests : any diff --git a/tests/baselines/reference/jsxClassAttributeResolution.errors.txt b/tests/baselines/reference/jsxClassAttributeResolution.errors.txt deleted file mode 100644 index 354df1ee641a2..0000000000000 --- a/tests/baselines/reference/jsxClassAttributeResolution.errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -file.tsx(2,19): error TS2741: Property 'ref' is missing in type '{}' but required in type 'IntrinsicClassAttributesAlias'. - - -==== file.tsx (1 errors) ==== - class App {} - export const a = ; - ~~~ -!!! error TS2741: Property 'ref' is missing in type '{}' but required in type 'IntrinsicClassAttributesAlias'. -!!! related TS2728 node_modules/@types/react/index.d.ts:2:5: 'ref' is declared here. -==== node_modules/@types/react/package.json (0 errors) ==== - { - "name": "@types/react", - "version": "0.0.1", - "main": "", - "types": "index.d.ts", - } -==== node_modules/@types/react/index.d.ts (0 errors) ==== - interface IntrinsicClassAttributesAlias { - ref: T - } - declare namespace JSX { - type IntrinsicClassAttributes = IntrinsicClassAttributesAlias - } -==== node_modules/@types/react/jsx-runtime.d.ts (0 errors) ==== - import './'; -==== node_modules/@types/react/jsx-dev-runtime.d.ts (0 errors) ==== - import './'; - \ No newline at end of file diff --git a/tests/baselines/reference/jsxClassAttributeResolution.js b/tests/baselines/reference/jsxClassAttributeResolution.js index 7fa77a36324a3..5a22fb2a6e12b 100644 --- a/tests/baselines/reference/jsxClassAttributeResolution.js +++ b/tests/baselines/reference/jsxClassAttributeResolution.js @@ -14,7 +14,7 @@ export const a = ; interface IntrinsicClassAttributesAlias { ref: T } -declare namespace JSX { +export declare namespace JSX { type IntrinsicClassAttributes = IntrinsicClassAttributesAlias } //// [jsx-runtime.d.ts] diff --git a/tests/baselines/reference/jsxClassAttributeResolution.symbols b/tests/baselines/reference/jsxClassAttributeResolution.symbols index de0ed218a0b6c..673dce6ce3896 100644 --- a/tests/baselines/reference/jsxClassAttributeResolution.symbols +++ b/tests/baselines/reference/jsxClassAttributeResolution.symbols @@ -18,11 +18,11 @@ interface IntrinsicClassAttributesAlias { >ref : Symbol(IntrinsicClassAttributesAlias.ref, Decl(index.d.ts, 0, 44)) >T : Symbol(T, Decl(index.d.ts, 0, 40)) } -declare namespace JSX { +export declare namespace JSX { >JSX : Symbol(JSX, Decl(index.d.ts, 2, 1)) type IntrinsicClassAttributes = IntrinsicClassAttributesAlias ->IntrinsicClassAttributes : Symbol(IntrinsicClassAttributes, Decl(index.d.ts, 3, 23)) +>IntrinsicClassAttributes : Symbol(IntrinsicClassAttributes, Decl(index.d.ts, 3, 30)) >T : Symbol(T, Decl(index.d.ts, 4, 34)) >IntrinsicClassAttributesAlias : Symbol(IntrinsicClassAttributesAlias, Decl(index.d.ts, 0, 0)) >T : Symbol(T, Decl(index.d.ts, 4, 34)) diff --git a/tests/baselines/reference/jsxClassAttributeResolution.types b/tests/baselines/reference/jsxClassAttributeResolution.types index d8b384531b466..c440d9679c2d2 100644 --- a/tests/baselines/reference/jsxClassAttributeResolution.types +++ b/tests/baselines/reference/jsxClassAttributeResolution.types @@ -6,10 +6,8 @@ class App {} > : ^^^ export const a = ; ->a : any -> : ^^^ -> : any -> : ^^^ +>a : error +> : error >App : typeof App > : ^^^^^^^^^^ >App : typeof App @@ -21,7 +19,7 @@ interface IntrinsicClassAttributesAlias { >ref : T > : ^ } -declare namespace JSX { +export declare namespace JSX { type IntrinsicClassAttributes = IntrinsicClassAttributesAlias >IntrinsicClassAttributes : IntrinsicClassAttributes > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.errors.txt b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.errors.txt new file mode 100644 index 0000000000000..13eb01d3431ca --- /dev/null +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.errors.txt @@ -0,0 +1,16 @@ +index.tsx(1,8): error TS2307: Cannot find module './jsx' or its corresponding type declarations. + + +==== index.tsx (1 errors) ==== + import "./jsx"; + ~~~~~~~ +!!! error TS2307: Cannot find module './jsx' or its corresponding type declarations. + + var skate: any; + const React = { createElement: skate.h }; + + class Component { + renderCallback() { + return
test
; + } + }; \ No newline at end of file diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types index c9a019263fe47..dbb1eed353c38 100644 --- a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types @@ -5,6 +5,7 @@ import "./jsx"; var skate: any; >skate : any +> : ^^^ const React = { createElement: skate.h }; >React : { createElement: any; } @@ -12,7 +13,9 @@ const React = { createElement: skate.h }; >{ createElement: skate.h } : { createElement: any; } > : ^^^^^^^^^^^^^^^^^^^^^^^ >createElement : any +> : ^^^ >skate.h : any +> : ^^^ >skate : any > : ^^^ >h : any @@ -27,7 +30,8 @@ class Component { > : ^^^^^^^^^ return
test
; ->
test
: error +>
test
: any +> : ^^^ >div : any > : ^^^ >div : any diff --git a/tests/baselines/reference/jsxImportForSideEffectsNonExtantNoError.errors.txt b/tests/baselines/reference/jsxImportForSideEffectsNonExtantNoError.errors.txt new file mode 100644 index 0000000000000..34182361b1ba1 --- /dev/null +++ b/tests/baselines/reference/jsxImportForSideEffectsNonExtantNoError.errors.txt @@ -0,0 +1,13 @@ +jsxImportForSideEffectsNonExtantNoError.tsx(4,8): error TS2307: Cannot find module './App.css' or its corresponding type declarations. + + +==== jsxImportForSideEffectsNonExtantNoError.tsx (1 errors) ==== + /// + import * as React from "react"; + + import "./App.css"; // doesn't actually exist + ~~~~~~~~~~~ +!!! error TS2307: Cannot find module './App.css' or its corresponding type declarations. + + const tag =
; + \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationGlobal5.js b/tests/baselines/reference/moduleAugmentationGlobal5.js index 5886a438f9da5..88ce41cbe2b6f 100644 --- a/tests/baselines/reference/moduleAugmentationGlobal5.js +++ b/tests/baselines/reference/moduleAugmentationGlobal5.js @@ -32,3 +32,32 @@ require("B"); //// [f3.d.ts] import "A"; import "B"; + + +//// [DtsFileErrors] + + +f3.d.ts(1,8): error TS2307: Cannot find module 'A' or its corresponding type declarations. +f3.d.ts(2,8): error TS2307: Cannot find module 'B' or its corresponding type declarations. + + +==== f3.d.ts (2 errors) ==== + import "A"; + ~~~ +!!! error TS2307: Cannot find module 'A' or its corresponding type declarations. + import "B"; + ~~~ +!!! error TS2307: Cannot find module 'B' or its corresponding type declarations. + +==== f1.d.ts (0 errors) ==== + declare module "A" { + global { + interface Something {x} + } + } +==== f2.d.ts (0 errors) ==== + declare module "B" { + global { + interface Something {y} + } + } \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationInAmbientModule5.js b/tests/baselines/reference/moduleAugmentationInAmbientModule5.js index 923100c74d22b..347fdc1977b2b 100644 --- a/tests/baselines/reference/moduleAugmentationInAmbientModule5.js +++ b/tests/baselines/reference/moduleAugmentationInAmbientModule5.js @@ -33,3 +33,30 @@ var y = x.getA().x; //// [f.d.ts] import "array"; + + +//// [DtsFileErrors] + + +f.d.ts(1,8): error TS2307: Cannot find module 'array' or its corresponding type declarations. + + +==== f.d.ts (1 errors) ==== + import "array"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'array' or its corresponding type declarations. + +==== array.d.ts (0 errors) ==== + declare module "A" { + class A { x: number; } + } + + declare module "array" { + import {A} from "A"; + global { + interface Array { + getA(): A; + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationsImports3.js b/tests/baselines/reference/moduleAugmentationsImports3.js index 14ae0f65f2ffa..100254136314d 100644 --- a/tests/baselines/reference/moduleAugmentationsImports3.js +++ b/tests/baselines/reference/moduleAugmentationsImports3.js @@ -106,3 +106,53 @@ declare module "main" { import "D"; import "e"; } + + +//// [DtsFileErrors] + + +f.d.ts(20,12): error TS2792: Cannot find module 'D'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +==== f.d.ts (1 errors) ==== + /// + declare module "a" { + export class A { + } + } + declare module "b" { + export class B { + x: number; + } + } + declare module "e" { + import { Cls } from "C"; + module "a" { + interface A { + getCls(): Cls; + } + } + } + declare module "main" { + import "D"; + ~~~ +!!! error TS2792: Cannot find module 'D'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import "e"; + } + +==== c.d.ts (0 errors) ==== + declare module "C" { + class Cls {y: string; } + } + +==== d.d.ts (0 errors) ==== + declare module "D" { + import {A} from "a"; + import {B} from "b"; + module "a" { + interface A { + getB(): B; + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleAugmentationsImports4.js b/tests/baselines/reference/moduleAugmentationsImports4.js index d009f154ad0fd..9bc575724e16c 100644 --- a/tests/baselines/reference/moduleAugmentationsImports4.js +++ b/tests/baselines/reference/moduleAugmentationsImports4.js @@ -93,3 +93,60 @@ declare module "main" { import "D"; import "E"; } + + +//// [DtsFileErrors] + + +f.d.ts(11,12): error TS2792: Cannot find module 'D'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +f.d.ts(12,12): error TS2792: Cannot find module 'E'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + + +==== f.d.ts (2 errors) ==== + declare module "a" { + export class A { + } + } + declare module "b" { + export class B { + x: number; + } + } + declare module "main" { + import "D"; + ~~~ +!!! error TS2792: Cannot find module 'D'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + import "E"; + ~~~ +!!! error TS2792: Cannot find module 'E'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? + } + +==== c.d.ts (0 errors) ==== + declare module "C" { + class Cls {y: string; } + } + +==== d.d.ts (0 errors) ==== + declare module "D" { + import {A} from "a"; + import {B} from "b"; + module "a" { + interface A { + getB(): B; + } + } + } + +==== e.d.ts (0 errors) ==== + /// + declare module "E" { + import {A} from "a"; + import {Cls} from "C"; + + module "a" { + interface A { + getCls(): Cls; + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.errors.txt b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.errors.txt new file mode 100644 index 0000000000000..f677838225b10 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.errors.txt @@ -0,0 +1,14 @@ +/a.ts(1,8): error TS2307: Cannot find module 'normalize.css' or its corresponding type declarations. + + +==== /a.ts (1 errors) ==== + import "normalize.css"; + ~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'normalize.css' or its corresponding type declarations. + +==== /node_modules/normalize.css/normalize.css (0 errors) ==== + This file is not read. + +==== /node_modules/normalize.css/package.json (0 errors) ==== + { "main": "normalize.css" } + \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.errors.txt b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.errors.txt new file mode 100644 index 0000000000000..0171f5e0b0c6e --- /dev/null +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.errors.txt @@ -0,0 +1,14 @@ +/a.ts(1,8): error TS2307: Cannot find module 'foo' or its corresponding type declarations. + + +==== /a.ts (1 errors) ==== + import "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo' or its corresponding type declarations. + +==== /node_modules/foo/foo.js (0 errors) ==== + This file is not read. + +==== /node_modules/foo/package.json (0 errors) ==== + { "types": "foo.js" } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).errors.txt index 15bd70e4c2e9d..92187a7e27b92 100644 --- a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).errors.txt @@ -1,3 +1,4 @@ +file.js(2,8): error TS2307: Cannot find module 'fs' or its corresponding type declarations. file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. @@ -22,9 +23,11 @@ subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ~~~~~~~~~~~ !!! error TS8003: 'export =' can only be used in TypeScript files. -==== file.js (1 errors) ==== +==== file.js (2 errors) ==== // esm format file import "fs"; + ~~~~ +!!! error TS2307: Cannot find module 'fs' or its corresponding type declarations. const a = {}; module.exports = a; ~~~~~~ diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt index 15bd70e4c2e9d..92187a7e27b92 100644 --- a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).errors.txt @@ -1,3 +1,4 @@ +file.js(2,8): error TS2307: Cannot find module 'fs' or its corresponding type declarations. file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. @@ -22,9 +23,11 @@ subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ~~~~~~~~~~~ !!! error TS8003: 'export =' can only be used in TypeScript files. -==== file.js (1 errors) ==== +==== file.js (2 errors) ==== // esm format file import "fs"; + ~~~~ +!!! error TS2307: Cannot find module 'fs' or its corresponding type declarations. const a = {}; module.exports = a; ~~~~~~ diff --git a/tests/baselines/reference/nodeModulesCJSEmit1.errors.txt b/tests/baselines/reference/nodeModulesCJSEmit1.errors.txt index 5e3604d311b92..8d9a1b4e1264a 100644 --- a/tests/baselines/reference/nodeModulesCJSEmit1.errors.txt +++ b/tests/baselines/reference/nodeModulesCJSEmit1.errors.txt @@ -1,3 +1,4 @@ +/3.cjs(1,8): error TS2307: Cannot find module 'foo' or its corresponding type declarations. /3.cjs(2,1): error TS2304: Cannot find name 'exports'. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. @@ -8,8 +9,10 @@ ==== /2.cjs (0 errors) ==== exports.foo = 0; -==== /3.cjs (1 errors) ==== +==== /3.cjs (2 errors) ==== import "foo"; + ~~~~~ +!!! error TS2307: Cannot find module 'foo' or its corresponding type declarations. exports.foo = {}; ~~~~~~~ !!! error TS2304: Cannot find name 'exports'. diff --git a/tests/baselines/reference/pathsValidation4.errors.txt b/tests/baselines/reference/pathsValidation4.errors.txt index 386079a29503b..6a449b9cdf14e 100644 --- a/tests/baselines/reference/pathsValidation4.errors.txt +++ b/tests/baselines/reference/pathsValidation4.errors.txt @@ -1,6 +1,7 @@ tsconfig.json(6,11): error TS5061: Pattern '@interface/**/*' can have at most one '*' character. tsconfig.json(7,11): error TS5061: Pattern '@service/**/*' can have at most one '*' character. tsconfig.json(7,29): error TS5062: Substitution './src/service/**/*' in pattern '@service/**/*' can have at most one '*' character. +src/main.ts(1,8): error TS2307: Cannot find module 'someModule' or its corresponding type declarations. ==== tsconfig.json (3 errors) ==== @@ -22,5 +23,7 @@ tsconfig.json(7,29): error TS5062: Substitution './src/service/**/*' in pattern } } -==== src/main.ts (0 errors) ==== - import 'someModule'; \ No newline at end of file +==== src/main.ts (1 errors) ==== + import 'someModule'; + ~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'someModule' or its corresponding type declarations. \ No newline at end of file diff --git a/tests/baselines/reference/pathsValidation5.errors.txt b/tests/baselines/reference/pathsValidation5.errors.txt index 80eaf2d68f6cb..c61e736a2b871 100644 --- a/tests/baselines/reference/pathsValidation5.errors.txt +++ b/tests/baselines/reference/pathsValidation5.errors.txt @@ -1,6 +1,7 @@ tsconfig.json(5,26): error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'? tsconfig.json(6,19): error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'? tsconfig.json(7,23): error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'? +src/main.ts(1,8): error TS2307: Cannot find module 'someModule' or its corresponding type declarations. ==== tsconfig.json (3 errors) ==== @@ -21,5 +22,7 @@ tsconfig.json(7,23): error TS5090: Non-relative paths are not allowed when 'base } } -==== src/main.ts (0 errors) ==== - import 'someModule'; \ No newline at end of file +==== src/main.ts (1 errors) ==== + import 'someModule'; + ~~~~~~~~~~~~ +!!! error TS2307: Cannot find module 'someModule' or its corresponding type declarations. \ No newline at end of file diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.js b/tests/baselines/reference/reactJsxReactResolvedNodeNext.js index f36fdc66c2a5b..c87ced322e9ef 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.js +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.js @@ -10,7 +10,7 @@ export const a =
; "types": "index.d.ts", } //// [index.d.ts] -declare namespace JSX { +export declare namespace JSX { interface IntrinsicElements { [x: string]: any; } } //// [jsx-runtime.d.ts] diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.symbols b/tests/baselines/reference/reactJsxReactResolvedNodeNext.symbols index e2ddca8d016e8..0923e46c6a196 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.symbols +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.symbols @@ -3,15 +3,13 @@ === file.tsx === export const a =
; >a : Symbol(a, Decl(file.tsx, 0, 12)) ->div : Symbol(JSX.IntrinsicElements.__index, Decl(index.d.ts, 1, 33)) ->div : Symbol(JSX.IntrinsicElements.__index, Decl(index.d.ts, 1, 33)) === node_modules/@types/react/index.d.ts === -declare namespace JSX { +export declare namespace JSX { >JSX : Symbol(JSX, Decl(index.d.ts, 0, 0)) interface IntrinsicElements { [x: string]: any; } ->IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 0, 23)) +>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 0, 30)) >x : Symbol(x, Decl(index.d.ts, 1, 35)) } === node_modules/@types/react/jsx-runtime.d.ts === diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNext.types b/tests/baselines/reference/reactJsxReactResolvedNodeNext.types index 0e14708fd9eff..48971205e1ae4 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNext.types +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNext.types @@ -10,7 +10,7 @@ export const a =
; > : ^^^ === node_modules/@types/react/index.d.ts === -declare namespace JSX { +export declare namespace JSX { interface IntrinsicElements { [x: string]: any; } >x : string > : ^^^^^^ diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.js b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.js index 834a8fa145c4e..cd40b8e423c8f 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.js +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.js @@ -18,7 +18,7 @@ export const a =
; } } //// [index.d.ts] -declare namespace JSX { +export declare namespace JSX { interface IntrinsicElements { [x: string]: any; } } //// [jsx-runtime.d.ts] diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.symbols b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.symbols index 5c5343253c544..6ac83a0ce6b27 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.symbols +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.symbols @@ -3,15 +3,13 @@ === file.tsx === export const a =
; >a : Symbol(a, Decl(file.tsx, 0, 12)) ->div : Symbol(JSX.IntrinsicElements.__index, Decl(index.d.ts, 1, 33)) ->div : Symbol(JSX.IntrinsicElements.__index, Decl(index.d.ts, 1, 33)) === node_modules/@types/react/index.d.ts === -declare namespace JSX { +export declare namespace JSX { >JSX : Symbol(JSX, Decl(index.d.ts, 0, 0)) interface IntrinsicElements { [x: string]: any; } ->IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 0, 23)) +>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 0, 30)) >x : Symbol(x, Decl(index.d.ts, 1, 35)) } === node_modules/@types/react/jsx-runtime.d.ts === diff --git a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.types b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.types index 5220535071b8b..bb074d664595d 100644 --- a/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.types +++ b/tests/baselines/reference/reactJsxReactResolvedNodeNextEsm.types @@ -10,7 +10,7 @@ export const a =
; > : ^^^ === node_modules/@types/react/index.d.ts === -declare namespace JSX { +export declare namespace JSX { interface IntrinsicElements { [x: string]: any; } >x : string > : ^^^^^^ diff --git a/tests/baselines/reference/systemModule9.errors.txt b/tests/baselines/reference/systemModule9.errors.txt index be5991350e5de..7dd2738dd6738 100644 --- a/tests/baselines/reference/systemModule9.errors.txt +++ b/tests/baselines/reference/systemModule9.errors.txt @@ -1,12 +1,13 @@ systemModule9.ts(1,21): error TS2792: Cannot find module 'file1'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? systemModule9.ts(2,25): error TS2792: Cannot find module 'file2'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? systemModule9.ts(3,15): error TS2792: Cannot find module 'file3'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? +systemModule9.ts(4,8): error TS2792: Cannot find module 'file4'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? systemModule9.ts(5,25): error TS2792: Cannot find module 'file5'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? systemModule9.ts(6,22): error TS2792: Cannot find module 'file6'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? systemModule9.ts(16,15): error TS2792: Cannot find module 'file7'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -==== systemModule9.ts (6 errors) ==== +==== systemModule9.ts (7 errors) ==== import * as ns from 'file1'; ~~~~~~~ !!! error TS2792: Cannot find module 'file1'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? @@ -17,6 +18,8 @@ systemModule9.ts(16,15): error TS2792: Cannot find module 'file7'. Did you mean ~~~~~~~ !!! error TS2792: Cannot find module 'file3'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import 'file4' + ~~~~~~~ +!!! error TS2792: Cannot find module 'file4'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? import e, * as ns2 from 'file5'; ~~~~~~~ !!! error TS2792: Cannot find module 'file5'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? diff --git a/tests/cases/compiler/jsxClassAttributeResolution.tsx b/tests/cases/compiler/jsxClassAttributeResolution.tsx index 32263ecd794ee..f18ae3d3d5d84 100644 --- a/tests/cases/compiler/jsxClassAttributeResolution.tsx +++ b/tests/cases/compiler/jsxClassAttributeResolution.tsx @@ -14,7 +14,7 @@ export const a = ; interface IntrinsicClassAttributesAlias { ref: T } -declare namespace JSX { +export declare namespace JSX { type IntrinsicClassAttributes = IntrinsicClassAttributesAlias } // @filename: node_modules/@types/react/jsx-runtime.d.ts diff --git a/tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx b/tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx index 0cc64eda70a14..9744c28f945cd 100644 --- a/tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx +++ b/tests/cases/compiler/reactJsxReactResolvedNodeNext.tsx @@ -11,7 +11,7 @@ export const a =
; "types": "index.d.ts", } // @filename: node_modules/@types/react/index.d.ts -declare namespace JSX { +export declare namespace JSX { interface IntrinsicElements { [x: string]: any; } } // @filename: node_modules/@types/react/jsx-runtime.d.ts diff --git a/tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx b/tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx index 6d2fc006f15db..d9a28c0fe4858 100644 --- a/tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx +++ b/tests/cases/compiler/reactJsxReactResolvedNodeNextEsm.tsx @@ -19,7 +19,7 @@ export const a =
; } } // @filename: node_modules/@types/react/index.d.ts -declare namespace JSX { +export declare namespace JSX { interface IntrinsicElements { [x: string]: any; } } // @filename: node_modules/@types/react/jsx-runtime.d.ts diff --git a/tests/cases/conformance/externalModules/typeOnly/allowsImportingTsExtension.ts b/tests/cases/conformance/externalModules/typeOnly/allowsImportingTsExtension.ts index 706a2f27b554b..be61a7b96f0a4 100644 --- a/tests/cases/conformance/externalModules/typeOnly/allowsImportingTsExtension.ts +++ b/tests/cases/conformance/externalModules/typeOnly/allowsImportingTsExtension.ts @@ -11,6 +11,7 @@ export class A {} // @Filename: b.ts import type { A } from "./a.ts"; // ok import {} from "./a.ts"; // error +import "./a.ts"; // error import { type A as _A } from "./a.ts"; // error type __A = import("./a.ts").A; // ok const aPromise = import("./a.ts"); // error @@ -18,6 +19,7 @@ const aPromise = import("./a.ts"); // error // @Filename: c.ts import type { A } from "./a.d.ts"; // ok import {} from "./a.d.ts"; // error +import "./a.d.ts"; // error import { type A as _A } from "./a.d.ts"; // error type __A = import("./a.d.ts").A; // ok const aPromise = import("./a.d.ts"); // error