Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix mistakenly disallowed default export under erasableSyntaxOnly
  • Loading branch information
jakebailey committed Feb 18, 2025
commit 636e028e6b9bb21bf3a1999c6394ff3592e7cd2d
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47974,7 +47974,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return;
}

if (compilerOptions.erasableSyntaxOnly && !(node.flags & NodeFlags.Ambient)) {
if (compilerOptions.erasableSyntaxOnly && node.isExportEquals && !(node.flags & NodeFlags.Ambient)) {
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
}
const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent as ModuleDeclaration;
Expand Down
5 changes: 1 addition & 4 deletions tests/baselines/reference/erasableSyntaxOnly.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
commonjs.cts(1,1): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
commonjs.cts(2,1): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
esm.mts(2,1): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
index.ts(3,17): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
index.ts(6,11): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
index.ts(10,11): error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
Expand Down Expand Up @@ -107,9 +106,7 @@ index.ts(28,12): error TS1294: This syntax is not allowed when 'erasableSyntaxOn
export = foo;


==== esm.mts (1 errors) ====
==== esm.mts (0 errors) ====
const foo = 1234;
export default foo;
~~~~~~~~~~~~~~~~~~~
!!! error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.