diff options
| author | Kitson Kelly <me@kitsonkelly.com> | 2021-01-28 06:54:20 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-28 06:54:20 +1100 |
| commit | 894ff6bb5881206c61fbd2abd3127e4f3001da95 (patch) | |
| tree | ca0f9ffe13e1e9e482d5fc1cbe4808372bd2bd96 /cli/tsc.rs | |
| parent | 2638aa03a5c3f7f4740ea7bee22127c01eb47a3c (diff) | |
fix(cli): early abort before type checking on missing modules (#9285)
Fixes #9275
Diffstat (limited to 'cli/tsc.rs')
| -rw-r--r-- | cli/tsc.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cli/tsc.rs b/cli/tsc.rs index 601e4c140..26b0c68fb 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -287,10 +287,10 @@ fn load(state: &mut State, args: Value) -> Result<Value, AnyError> { state.maybe_tsbuildinfo.clone() // in certain situations we return a "blank" module to tsc and we need to // handle the request for that module here. - } else if &v.specifier == "deno:///none.d.ts" { + } else if &v.specifier == "deno:///missing_dependency.d.ts" { hash = Some("1".to_string()); - media_type = MediaType::TypeScript; - Some("declare var a: any;\nexport = a;\n".to_string()) + media_type = MediaType::Dts; + Some("declare const __: any;\nexport = __;\n".to_string()) } else if v.specifier.starts_with("asset:///") { let name = v.specifier.replace("asset:///", ""); let maybe_source = get_asset(&name).map(|s| s.to_string()); @@ -383,7 +383,10 @@ fn resolve(state: &mut State, args: Value) -> Result<Value, AnyError> { // the source file in the graph, so we will return a fake module to // make tsc happy. Err(_) => { - resolved.push(("deno:///none.d.ts".to_string(), ".d.ts".to_string())); + resolved.push(( + "deno:///missing_dependency.d.ts".to_string(), + ".d.ts".to_string(), + )); } } } @@ -816,7 +819,10 @@ mod tests { &mut state, json!({ "base": "https://deno.land/x/a.ts", "specifiers": [ "./bad.ts" ]}), ).expect("should have not errored"); - assert_eq!(actual, json!([["deno:///none.d.ts", ".d.ts"]])); + assert_eq!( + actual, + json!([["deno:///missing_dependency.d.ts", ".d.ts"]]) + ); } #[tokio::test] |
