mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(typescript): allow synthetic default imports when using ModuleKind.ESNext
(#16438)
Closes #16437
This commit is contained in:
parent
65f12f571b
commit
bfd9912e1f
5 changed files with 24 additions and 1 deletions
|
@ -57,6 +57,11 @@ itest!(check_npm_install_diagnostics {
|
|||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(check_export_equals_declaration_file {
|
||||
args: "check --quiet check/export_equals_declaration_file/main.ts",
|
||||
exit_code: 0,
|
||||
});
|
||||
|
||||
#[test]
|
||||
fn cache_switching_config_then_no_config() {
|
||||
let deno_dir = util::new_deno_dir();
|
||||
|
|
6
cli/tests/testdata/check/export_equals_declaration_file/main.ts
vendored
Normal file
6
cli/tests/testdata/check/export_equals_declaration_file/main.ts
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
// @deno-types="./other.d.ts"
|
||||
import Test, { type Attributes } from "./other.js";
|
||||
|
||||
const other: Attributes = {};
|
||||
console.log(Test());
|
||||
console.log(other);
|
9
cli/tests/testdata/check/export_equals_declaration_file/other.d.ts
vendored
Normal file
9
cli/tests/testdata/check/export_equals_declaration_file/other.d.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
export = other;
|
||||
|
||||
declare function other(): string;
|
||||
|
||||
declare namespace other {
|
||||
interface Attributes {
|
||||
[attr: string]: string;
|
||||
}
|
||||
}
|
3
cli/tests/testdata/check/export_equals_declaration_file/other.js
vendored
Normal file
3
cli/tests/testdata/check/export_equals_declaration_file/other.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default function other() {
|
||||
return "test";
|
||||
}
|
2
cli/tsc/00_typescript.js
vendored
2
cli/tsc/00_typescript.js
vendored
|
@ -51163,7 +51163,7 @@ var ts;
|
|||
var usageMode = file && getUsageModeForExpression(usage);
|
||||
if (file && usageMode !== undefined) {
|
||||
var result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
||||
if (usageMode === ts.ModuleKind.ESNext || result) {
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
// fallthrough on cjs usages so we imply defaults for interop'd imports, too
|
||||
|
|
Loading…
Reference in a new issue