diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-02-21 08:35:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-21 08:35:25 -0500 |
commit | 9166d8a4e9b0f611b1e06c9e339b44f7c450d72e (patch) | |
tree | 1c4efed34b9c5bebc1f42fdaa8ad28dcca30896a /cli/graph_util.rs | |
parent | 061ee9d38cdf8ff0ade2373c1e075f841c534c47 (diff) |
feat(publish): type check on publish (#22506)
Supersedes #22501 and also fixes that issue.
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r-- | cli/graph_util.rs | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs index de13f25ba..51f07af5e 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -281,6 +281,9 @@ impl ModuleGraphCreator { loader: None, }) .await?; + if self.options.type_check_mode().is_true() { + self.type_check_graph(graph.clone()).await?; + } self.module_graph_builder.build_fast_check_graph( &mut graph, BuildFastCheckGraphOptions { @@ -337,23 +340,31 @@ impl ModuleGraphCreator { if self.options.type_check_mode().is_true() { // provide the graph to the type checker, then get it back after it's done - let graph = self - .type_checker - .check( - graph, - check::CheckOptions { - build_fast_check_graph: true, - lib: self.options.ts_type_lib_window(), - log_ignored_options: true, - reload: self.options.reload_flag(), - }, - ) - .await?; + let graph = self.type_check_graph(graph).await?; Ok(graph) } else { Ok(Arc::new(graph)) } } + + async fn type_check_graph( + &self, + graph: ModuleGraph, + ) -> Result<Arc<ModuleGraph>, AnyError> { + self + .type_checker + .check( + graph, + check::CheckOptions { + build_fast_check_graph: true, + lib: self.options.ts_type_lib_window(), + log_ignored_options: true, + reload: self.options.reload_flag(), + type_check_mode: self.options.type_check_mode(), + }, + ) + .await + } } pub struct BuildFastCheckGraphOptions { |