diff options
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/check.rs | 13 | ||||
-rw-r--r-- | cli/tools/registry/mod.rs | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/cli/tools/check.rs b/cli/tools/check.rs index 08fc6f087..68bf9716e 100644 --- a/cli/tools/check.rs +++ b/cli/tools/check.rs @@ -44,6 +44,8 @@ pub struct CheckOptions { /// If true, valid `.tsbuildinfo` files will be ignored and type checking /// will always occur. pub reload: bool, + /// Mode to type check with. + pub type_check_mode: TypeCheckMode, } pub struct TypeChecker { @@ -97,6 +99,7 @@ impl TypeChecker { mut graph: ModuleGraph, options: CheckOptions, ) -> Result<(Arc<ModuleGraph>, Diagnostics), AnyError> { + debug_assert_ne!(options.type_check_mode, TypeCheckMode::None); if graph.roots.is_empty() { return Ok((graph.into(), Default::default())); } @@ -120,8 +123,8 @@ impl TypeChecker { } } + let type_check_mode = options.type_check_mode; let ts_config = ts_config_result.ts_config; - let type_check_mode = self.cli_options.type_check_mode(); let maybe_check_hash = match self.npm_resolver.check_state_hash() { Some(npm_check_hash) => { match get_check_hash( @@ -300,7 +303,13 @@ fn get_check_hash( } hasher.write_str(module.specifier.as_str()); - hasher.write_str(&module.source); + hasher.write_str( + // the fast check module will only be set when publishing + module + .fast_check_module() + .map(|s| s.source.as_ref()) + .unwrap_or(&module.source), + ); } Module::Node(_) => { // the @types/node package will be in the resolved diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index 951ac4944..aea5dc634 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -28,6 +28,7 @@ use crate::args::jsr_url; use crate::args::CliOptions; use crate::args::Flags; use crate::args::PublishFlags; +use crate::args::TypeCheckMode; use crate::cache::LazyGraphSourceParser; use crate::cache::ParsedSourceCache; use crate::factory::CliFactory; @@ -768,6 +769,8 @@ async fn build_and_check_graph_for_publish( lib: cli_options.ts_type_lib_window(), log_ignored_options: false, reload: cli_options.reload_flag(), + // force type checking this + type_check_mode: TypeCheckMode::Local, }, ) .await?; |