From bcfe279fba865763c87f9cd8d5a2d0b2cbf451be Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 21 Oct 2022 11:20:18 -0400 Subject: feat(unstable/npm): initial type checking of npm specifiers (#16332) --- cli/tools/check.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cli/tools') diff --git a/cli/tools/check.rs b/cli/tools/check.rs index bb0b873f4..88c05e130 100644 --- a/cli/tools/check.rs +++ b/cli/tools/check.rs @@ -18,6 +18,7 @@ use crate::cache::TypeCheckCache; use crate::diagnostics::Diagnostics; use crate::graph_util::GraphData; use crate::graph_util::ModuleEntry; +use crate::npm::NpmPackageResolver; use crate::tsc; use crate::tsc::Stats; use crate::version; @@ -57,6 +58,7 @@ pub fn check( roots: &[(ModuleSpecifier, ModuleKind)], graph_data: Arc>, cache: &TypeCheckCache, + npm_resolver: NpmPackageResolver, options: CheckOptions, ) -> Result { let check_js = options.ts_config.get_check_js(); @@ -106,6 +108,7 @@ pub fn check( graph_data, hash_data, maybe_config_specifier: options.maybe_config_specifier, + maybe_npm_resolver: Some(npm_resolver.clone()), maybe_tsbuildinfo, root_names, })?; @@ -114,6 +117,9 @@ pub fn check( response.diagnostics.filter(|d| { if let Some(file_name) = &d.file_name { !file_name.starts_with("http") + && ModuleSpecifier::parse(file_name) + .map(|specifier| !npm_resolver.in_npm_package(&specifier)) + .unwrap_or(true) } else { true } -- cgit v1.2.3