@@ -364,21 +364,18 @@ pub struct CreateGraphOptions<'a> {
364364
365365pub struct ModuleGraphCreator {
366366 options : Arc < CliOptions > ,
367- npm_installer : Option < Arc < NpmInstaller > > ,
368367 module_graph_builder : Arc < ModuleGraphBuilder > ,
369368 type_checker : Arc < TypeChecker > ,
370369}
371370
372371impl ModuleGraphCreator {
373372 pub fn new (
374373 options : Arc < CliOptions > ,
375- npm_installer : Option < Arc < NpmInstaller > > ,
376374 module_graph_builder : Arc < ModuleGraphBuilder > ,
377375 type_checker : Arc < TypeChecker > ,
378376 ) -> Self {
379377 Self {
380378 options,
381- npm_installer,
382379 module_graph_builder,
383380 type_checker,
384381 }
@@ -469,7 +466,7 @@ impl ModuleGraphCreator {
469466 if self . options . type_check_mode ( ) . is_true ( )
470467 && !graph_has_external_remote ( & graph)
471468 {
472- self . type_check_graph ( graph. clone ( ) ) . await ?;
469+ self . type_check_graph ( graph. clone ( ) ) ?;
473470 }
474471
475472 if build_fast_check_graph {
@@ -501,12 +498,6 @@ impl ModuleGraphCreator {
501498 . build_graph_with_npm_resolution ( & mut graph, options)
502499 . await ?;
503500
504- if let Some ( npm_installer) = & self . npm_installer {
505- if graph. has_node_specifier && self . options . type_check_mode ( ) . is_true ( ) {
506- npm_installer. inject_synthetic_types_node_package ( ) . await ?;
507- }
508- }
509-
510501 Ok ( graph)
511502 }
512503
@@ -530,7 +521,7 @@ impl ModuleGraphCreator {
530521
531522 if self . options . type_check_mode ( ) . is_true ( ) {
532523 // provide the graph to the type checker, then get it back after it's done
533- let graph = self . type_check_graph ( graph) . await ?;
524+ let graph = self . type_check_graph ( graph) ?;
534525 Ok ( graph)
535526 } else {
536527 Ok ( Arc :: new ( graph) )
@@ -541,22 +532,19 @@ impl ModuleGraphCreator {
541532 self . module_graph_builder . graph_valid ( graph)
542533 }
543534
544- async fn type_check_graph (
535+ fn type_check_graph (
545536 & self ,
546537 graph : ModuleGraph ,
547538 ) -> Result < Arc < ModuleGraph > , CheckError > {
548- self
549- . type_checker
550- . check (
551- graph,
552- CheckOptions {
553- build_fast_check_graph : true ,
554- lib : self . options . ts_type_lib_window ( ) ,
555- reload : self . options . reload_flag ( ) ,
556- type_check_mode : self . options . type_check_mode ( ) ,
557- } ,
558- )
559- . await
539+ self . type_checker . check (
540+ graph,
541+ CheckOptions {
542+ build_fast_check_graph : true ,
543+ lib : self . options . ts_type_lib_window ( ) ,
544+ reload : self . options . reload_flag ( ) ,
545+ type_check_mode : self . options . type_check_mode ( ) ,
546+ } ,
547+ )
560548 }
561549}
562550
@@ -785,7 +773,15 @@ impl ModuleGraphBuilder {
785773 } ,
786774 options. npm_caching ,
787775 )
788- . await
776+ . await ?;
777+
778+ if let Some ( npm_installer) = & self . npm_installer {
779+ if graph. has_node_specifier && options. graph_kind . include_types ( ) {
780+ npm_installer. inject_synthetic_types_node_package ( ) . await ?;
781+ }
782+ }
783+
784+ Ok ( ( ) )
789785 }
790786
791787 async fn build_graph_with_npm_resolution_and_build_options < ' a > (
0 commit comments