From 3b8cafe40e79d5d63fc8d84e3804e7b166b01d5d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 24 Apr 2017 15:19:30 -0700 Subject: [PATCH] Reword message:more detail about declaration files --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- .../reference/untypedModuleImport_noImplicitAny.errors.txt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2f1b63471b5..1c5f36f73c5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1642,7 +1642,7 @@ namespace ts { } else if (noImplicitAny && moduleNotFoundError) { let errorInfo = chainDiagnosticMessages(/*details*/ undefined, - Diagnostics.Try_npm_install_types_Slash_0_if_it_exists_or_adding_declare_module_0_in_a_separate_file, + Diagnostics.Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, moduleReference); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 447e403469f..b69adf708f2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3310,7 +3310,7 @@ "category": "Error", "code": 7034 }, - "Try `npm install @types/{0}` if it exists or adding `declare module '{0}'` in a separate file.": { + "Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`": { "category": "Error", "code": 7035 }, diff --git a/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt b/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt index cd9d1f0b031..0f451941bd7 100644 --- a/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt +++ b/tests/baselines/reference/untypedModuleImport_noImplicitAny.errors.txt @@ -1,12 +1,12 @@ /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. - Try `npm install @types/foo` if it exists or adding `declare module 'foo'` in a separate file. + Try `npm install @types/foo` if it exists or add a new declaration (.d.ts) file containing `declare module 'foo';` ==== /a.ts (1 errors) ==== import * as foo from "foo"; ~~~~~ !!! error TS7016: Could not find a declaration file for module 'foo'. '/node_modules/foo/index.js' implicitly has an 'any' type. -!!! error TS7016: Try `npm install @types/foo` if it exists or adding `declare module 'foo'` in a separate file. +!!! error TS7016: Try `npm install @types/foo` if it exists or add a new declaration (.d.ts) file containing `declare module 'foo';` ==== /node_modules/foo/index.js (0 errors) ==== // This tests that `--noImplicitAny` disables untyped modules.