Skip to content

Commit 3b8cafe

Browse files
committed
Reword message:more detail about declaration files
1 parent 65dae3b commit 3b8cafe

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ namespace ts {
16421642
}
16431643
else if (noImplicitAny && moduleNotFoundError) {
16441644
let errorInfo = chainDiagnosticMessages(/*details*/ undefined,
1645-
Diagnostics.Try_npm_install_types_Slash_0_if_it_exists_or_adding_declare_module_0_in_a_separate_file,
1645+
Diagnostics.Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
16461646
moduleReference);
16471647
errorInfo = chainDiagnosticMessages(errorInfo,
16481648
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type,

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,7 +3310,7 @@
33103310
"category": "Error",
33113311
"code": 7034
33123312
},
3313-
"Try `npm install @types/{0}` if it exists or adding `declare module '{0}'` in a separate file.": {
3313+
"Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`": {
33143314
"category": "Error",
33153315
"code": 7035
33163316
},

tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/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.
2-
Try `npm install @types/foo` if it exists or adding `declare module 'foo'` in a separate file.
2+
Try `npm install @types/foo` if it exists or add a new declaration (.d.ts) file containing `declare module 'foo';`
33

44

55
==== /a.ts (1 errors) ====
66
import * as foo from "foo";
77
~~~~~
88
!!! error TS7016: Could not find a declaration file for module 'foo'. '/node_modules/foo/index.js' implicitly has an 'any' type.
9-
!!! error TS7016: Try `npm install @types/foo` if it exists or adding `declare module 'foo'` in a separate file.
9+
!!! error TS7016: Try `npm install @types/foo` if it exists or add a new declaration (.d.ts) file containing `declare module 'foo';`
1010

1111
==== /node_modules/foo/index.js (0 errors) ====
1212
// This tests that `--noImplicitAny` disables untyped modules.

0 commit comments

Comments
 (0)