diff options
Diffstat (limited to 'cli/tools/check.rs')
-rw-r--r-- | cli/tools/check.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/cli/tools/check.rs b/cli/tools/check.rs index 2ab4fe498..d669a736f 100644 --- a/cli/tools/check.rs +++ b/cli/tools/check.rs @@ -232,10 +232,16 @@ fn get_tsc_roots( graph_data: &GraphData, check_js: bool, ) -> Vec<(ModuleSpecifier, MediaType)> { - graph_data - .entries() - .into_iter() - .filter_map(|(specifier, module_entry)| match module_entry { + let mut result = Vec::new(); + if graph_data.has_node_builtin_specifier() { + // inject a specifier that will resolve node types + result.push(( + ModuleSpecifier::parse("asset:///node_types.d.ts").unwrap(), + MediaType::Dts, + )); + } + result.extend(graph_data.entries().into_iter().filter_map( + |(specifier, module_entry)| match module_entry { ModuleEntry::Module { media_type, code, .. } => match media_type { @@ -252,8 +258,9 @@ fn get_tsc_roots( _ => None, }, _ => None, - }) - .collect() + }, + )); + result } /// Matches the `@ts-check` pragma. |