From c1cf9019973b71836df8ce8a820414bb02e11d46 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 17 Mar 2022 22:44:42 +0200 Subject: [PATCH] fix(48291): omit jsdoc modifiers (#48304) --- src/compiler/checker.ts | 2 +- .../reference/plainJSGrammarErrors2.js | 22 +++++++++++++++++++ .../reference/plainJSGrammarErrors2.symbols | 13 +++++++++++ .../reference/plainJSGrammarErrors2.types | 13 +++++++++++ .../salsa/plainJSGrammarErrors2.ts | 14 ++++++++++++ 5 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/plainJSGrammarErrors2.js create mode 100644 tests/baselines/reference/plainJSGrammarErrors2.symbols create mode 100644 tests/baselines/reference/plainJSGrammarErrors2.types create mode 100644 tests/cases/conformance/salsa/plainJSGrammarErrors2.ts 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";