diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f9c00b5c158..4f8f9b3f68c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1401,7 +1401,7 @@ namespace ts { if (compilerOptions.noImplicitAny) { if (moduleNotFoundError) { error(errorNode, - Diagnostics.A_package_for_0_was_found_at_1_but_is_untyped_Because_noImplicitAny_is_enabled_this_package_must_have_a_declaration, + Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1c14d005cb2..e2a2a4b9a0c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2869,10 +2869,6 @@ "category": "Error", "code": 6143 }, - "A package for '{0}' was found at '{1}', but is untyped. Because '--noImplicitAny' is enabled, this package must have a declaration.": { - "category": "Error", - "code": 6144 - }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 @@ -2905,6 +2901,10 @@ "category": "Error", "code": 7015 }, + "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type.": { + "category": "Error", + "code": 7016 + }, "Index signature of object type implicitly has an 'any' type.": { "category": "Error", "code": 7017 diff --git a/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt b/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt index 7f846c1cd2e..349a944deeb 100644 --- a/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt +++ b/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt @@ -1,10 +1,10 @@ -/a.ts(1,22): error TS6144: A package for 'foo' was found at '/node_modules/foo/index.js', but is untyped. Because '--noImplicitAny' is enabled, this package must have a declaration. +/a.ts(1,22): error TS7016: Could not find a declaration file for module 'foo'. '/node_modules/foo/index.js' implicitly has an 'any' type. ==== /a.ts (1 errors) ==== import * as foo from "foo"; ~~~~~ -!!! error TS6144: A package for 'foo' was found at '/node_modules/foo/index.js', but is untyped. Because '--noImplicitAny' is enabled, this package must have a declaration. +!!! error TS7016: Could not find a declaration file for module 'foo'. '/node_modules/foo/index.js' implicitly has an 'any' type. ==== /node_modules/foo/index.js (0 errors) ==== // This tests that `--noImplicitAny` disables untyped modules.