diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0d7adfafede..43dafe03456 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -40540,7 +40540,7 @@ namespace ts { return; } - if (!checkGrammarDecoratorsAndModifiers(node) && hasEffectiveModifiers(node)) { + if (!checkGrammarDecoratorsAndModifiers(node) && hasSyntacticModifiers(node)) { grammarErrorOnFirstToken(node, Diagnostics.An_export_declaration_cannot_have_modifiers); } diff --git a/tests/baselines/reference/plainJSGrammarErrors2.js b/tests/baselines/reference/plainJSGrammarErrors2.js new file mode 100644 index 00000000000..501dd231c19 --- /dev/null +++ b/tests/baselines/reference/plainJSGrammarErrors2.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/salsa/plainJSGrammarErrors2.ts] //// + +//// [plainJSGrammarErrors2.js] + +//// [a.js] +export default 1; + +//// [b.js] +/** + * @deprecated + */ +export { default as A } from "./a"; + + +//// [plainJSGrammarErrors2.js] +//// [a.js] +export default 1; +//// [b.js] +/** + * @deprecated + */ +export { default as A } from "./a"; diff --git a/tests/baselines/reference/plainJSGrammarErrors2.symbols b/tests/baselines/reference/plainJSGrammarErrors2.symbols new file mode 100644 index 00000000000..d4186554ad0 --- /dev/null +++ b/tests/baselines/reference/plainJSGrammarErrors2.symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/salsa/plainJSGrammarErrors2.js === + +No type information for this code.=== /a.js === +export default 1; +No type information for this code. +No type information for this code.=== /b.js === +/** + * @deprecated + */ +export { default as A } from "./a"; +>default : Symbol(default, Decl(a.js, 0, 0)) +>A : Symbol(A, Decl(b.js, 3, 8)) + diff --git a/tests/baselines/reference/plainJSGrammarErrors2.types b/tests/baselines/reference/plainJSGrammarErrors2.types new file mode 100644 index 00000000000..d2c6ae93364 --- /dev/null +++ b/tests/baselines/reference/plainJSGrammarErrors2.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/salsa/plainJSGrammarErrors2.js === + +No type information for this code.=== /a.js === +export default 1; +No type information for this code. +No type information for this code.=== /b.js === +/** + * @deprecated + */ +export { default as A } from "./a"; +>default : 1 +>A : 1 + diff --git a/tests/cases/conformance/salsa/plainJSGrammarErrors2.ts b/tests/cases/conformance/salsa/plainJSGrammarErrors2.ts new file mode 100644 index 00000000000..73dfb48001e --- /dev/null +++ b/tests/cases/conformance/salsa/plainJSGrammarErrors2.ts @@ -0,0 +1,14 @@ +// @outdir: out/ +// @target: esnext +// @module: esnext +// @allowJs: true +// @filename: plainJSGrammarErrors2.js + +// @filename: /a.js +export default 1; + +// @filename: /b.js +/** + * @deprecated + */ +export { default as A } from "./a";