diff options
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r-- | cli/args/flags.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index c4d8a3f87..2e4d826f9 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -9,6 +9,7 @@ use clap::Command; use clap::ValueHint; use deno_core::resolve_url_or_path; use deno_core::url::Url; +use deno_graph::GraphKind; use deno_runtime::permissions::parse_sys_kind; use log::debug; use log::Level; @@ -255,6 +256,25 @@ pub enum TypeCheckMode { Local, } +impl TypeCheckMode { + /// Gets if type checking will occur under this mode. + pub fn is_true(&self) -> bool { + match self { + Self::None => false, + Self::Local | Self::All => true, + } + } + + /// Gets the corresponding module `GraphKind` that should be created + /// for the current `TypeCheckMode`. + pub fn as_graph_kind(&self) -> GraphKind { + match self.is_true() { + true => GraphKind::All, + false => GraphKind::CodeOnly, + } + } +} + impl Default for TypeCheckMode { fn default() -> Self { Self::None |