diff --git a/crates/stc_ts_errors/src/lib.rs b/crates/stc_ts_errors/src/lib.rs index e5b486955a..7bdf5ff2c4 100644 --- a/crates/stc_ts_errors/src/lib.rs +++ b/crates/stc_ts_errors/src/lib.rs @@ -2201,6 +2201,8 @@ impl ErrorKind { ErrorKind::RestParamMustBeLast { .. } => 1014, + ErrorKind::ImportFailed { .. } => 2305, + _ => 0, } } diff --git a/crates/stc_ts_type_checker/tests/conformance.pass.txt b/crates/stc_ts_type_checker/tests/conformance.pass.txt index b3f30d3722..7620551fec 100644 --- a/crates/stc_ts_type_checker/tests/conformance.pass.txt +++ b/crates/stc_ts_type_checker/tests/conformance.pass.txt @@ -1808,6 +1808,7 @@ jsdoc/parseThrowsTag.ts jsdoc/seeTag1.ts jsdoc/seeTag2.ts jsx/tsxEmitSpreadAttribute.ts +moduleResolution/importFromDot.ts moduleResolution/packageJsonImportsExportsOptionCompat.ts nonjsExtensions/declarationFileForJsonImport.ts override/override10.ts diff --git a/crates/stc_ts_type_checker/tests/conformance/es6/modules/exportSpellingSuggestion.error-diff.json b/crates/stc_ts_type_checker/tests/conformance/es6/modules/exportSpellingSuggestion.error-diff.json index db75f7c375..2dfa3bc74e 100644 --- a/crates/stc_ts_type_checker/tests/conformance/es6/modules/exportSpellingSuggestion.error-diff.json +++ b/crates/stc_ts_type_checker/tests/conformance/es6/modules/exportSpellingSuggestion.error-diff.json @@ -8,10 +8,10 @@ ] }, "extra_errors": { - "TS0": 1 + "TS2305": 1 }, "extra_error_lines": { - "TS0": [ + "TS2305": [ 1 ] } diff --git a/crates/stc_ts_type_checker/tests/conformance/moduleResolution/importFromDot.stats.rust-debug b/crates/stc_ts_type_checker/tests/conformance/moduleResolution/importFromDot.stats.rust-debug index f79107e8ee..f3e39f53bd 100644 --- a/crates/stc_ts_type_checker/tests/conformance/moduleResolution/importFromDot.stats.rust-debug +++ b/crates/stc_ts_type_checker/tests/conformance/moduleResolution/importFromDot.stats.rust-debug @@ -1,6 +1,6 @@ Stats { - required_error: 1, - matched_error: 0, + required_error: 0, + matched_error: 1, extra_error: 0, - panic: 1, + panic: 0, } \ No newline at end of file diff --git a/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug b/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug index f3dcdb9b04..9a3b700764 100644 --- a/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug +++ b/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug @@ -1,6 +1,5 @@ Stats { - required_error: 3503, - matched_error: 6532, + required_error: 3502, + matched_error: 6533, extra_error: 764, - panic: 74, } \ No newline at end of file diff --git a/crates/stc_ts_type_checker/tests/tsc.rs b/crates/stc_ts_type_checker/tests/tsc.rs index ea9b51b98b..5666522e23 100644 --- a/crates/stc_ts_type_checker/tests/tsc.rs +++ b/crates/stc_ts_type_checker/tests/tsc.rs @@ -606,6 +606,26 @@ impl Resolve for TestFileSystem { return Ok(FileName::Real(filename.into())); } + if module_specifier == "." { + let path = PathBuf::from(base.to_string()); + match path.parent() { + Some(cur_dir) => { + for (name, _) in self.files.iter() { + if format!("{}/index.ts", cur_dir.display()) == *name || format!("{}/index.tsx", cur_dir.display()) == *name { + return Ok(FileName::Real(name.into())); + } + } + } + None => { + for (name, _) in self.files.iter() { + if "index.ts" == *name || "index.tsx" == *name { + return Ok(FileName::Real(name.into())); + } + } + } + } + } + todo!("resolve: current = {:?}; target ={:?}", base, module_specifier); } }