diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 390c843b0c9..60c4b5d1d4e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -27628,27 +27628,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { case "console": return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom; case "$": - return compilerOptions.types - ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig - : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery; + return Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig; case "describe": case "suite": case "it": case "test": - return compilerOptions.types - ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig - : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha; + return Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig; case "process": case "require": case "Buffer": case "module": - return compilerOptions.types - ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig - : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode; + return Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig; case "Bun": - return compilerOptions.types - ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig - : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun; + return Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig; case "Map": case "Set": case "Promise": diff --git a/src/compiler/programDiagnostics.ts b/src/compiler/programDiagnostics.ts index ee4d1161eaa..45adc9ca756 100644 --- a/src/compiler/programDiagnostics.ts +++ b/src/compiler/programDiagnostics.ts @@ -400,7 +400,6 @@ export function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax: ) : undefined; case FileIncludeKind.AutomaticTypeDirectiveFile: - if (!options.types) return undefined; configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "types", reason.typeReference); message = Diagnostics.File_is_entry_point_of_type_library_specified_here; break; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 6f1fc390723..4545b880907 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1667,7 +1667,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD */ function updateTypeRootsWatch() { const options = resolutionHost.getCompilationSettings(); - if (options.types) { + if (options.types && !options.types.includes("*")) { // No need to do any watch since resolution cache is going to handle the failed lookups // for the types added by this closeTypeRootsWatch(); diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 4a49afdc364..19ba279f011 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -529,13 +529,9 @@ export function fileIncludeReasonToDiagnostics(program: Program, reason: FileInc options.outFile ? "--outFile" : "--out", ); case FileIncludeKind.AutomaticTypeDirectiveFile: { - const messageAndArgs: DiagnosticAndArguments = options.types ? - reason.packageId ? - [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : - [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions, reason.typeReference] : - reason.packageId ? - [Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : - [Diagnostics.Entry_point_for_implicit_type_library_0, reason.typeReference]; + const messageAndArgs: DiagnosticAndArguments = reason.packageId ? + [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : + [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions, reason.typeReference]; return chainDiagnosticMessages(/*details*/ undefined, ...messageAndArgs); } diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 4554eb4c731..3153d329d10 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -133,7 +133,7 @@ export function discoverTypings( const exclude = typeAcquisition.exclude || []; // Directories to search for package.json, bower.json and other typing information - if (!compilerOptions.types) { + if (!compilerOptions.types || compilerOptions.types.includes("*")) { const possibleSearchDirs = new Set(fileNames.map(getDirectoryPath)); possibleSearchDirs.add(projectRootPath); possibleSearchDirs.forEach(searchDir => {