summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-04-15 17:50:52 -0400
committerGitHub <noreply@github.com>2024-04-15 17:50:52 -0400
commit6f278e5c40d101f0fb8e7b69e28d34b1c766a8fe (patch)
tree97d3edc0f0b527c3dc7f07ba71d5828cd2c77943 /cli/lsp/tsc.rs
parent7e4ee02e2e37db8adfaf4a05aba3819838904650 (diff)
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was actually cjs leading to type checking errors.
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 2e0726a79..13da932f7 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -3996,6 +3996,7 @@ struct LoadResponse {
data: Arc<str>,
script_kind: i32,
version: Option<String>,
+ is_cjs: bool,
}
#[op2]
@@ -4018,6 +4019,10 @@ fn op_load<'s>(
data: doc.text(),
script_kind: crate::tsc::as_ts_script_kind(doc.media_type()),
version: state.script_version(&specifier),
+ is_cjs: matches!(
+ doc.media_type(),
+ MediaType::Cjs | MediaType::Cts | MediaType::Dcts
+ ),
})
};