diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 25b86e67d3..a34a7b02c3 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2729,11 +2729,6 @@ "category": "Error", "code": 8016 }, - "'decorators' can only be used in a .ts file.": { - "category": "Error", - "code": 8017 - }, - "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": { "category": "Error", "code": 9002 diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 7a2e65ed33..bfea431d9a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1168,9 +1168,6 @@ namespace ts { let typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case SyntaxKind.Decorator: - diagnostics.push(createDiagnosticForNode(node, Diagnostics.decorators_can_only_be_used_in_a_ts_file)); - return true; } return forEachChild(node, walk); diff --git a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.errors.txt b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.errors.txt deleted file mode 100644 index a39d2e1665..0000000000 --- a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -tests/cases/compiler/a.js(1,1): error TS8017: 'decorators' can only be used in a .ts file. - - -!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. -==== tests/cases/compiler/a.js (1 errors) ==== - @internal class C { } - ~~~~~~~~~ -!!! error TS8017: 'decorators' can only be used in a .ts file. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.symbols b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.symbols new file mode 100644 index 0000000000..02973b4314 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/a.js === +@internal class C { } +>C : Symbol(C, Decl(a.js, 0, 0)) + diff --git a/tests/baselines/reference/jsFileCompilationDecoratorSyntax.types b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.types new file mode 100644 index 0000000000..ee1f14129d --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationDecoratorSyntax.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/a.js === +@internal class C { } +>internal : any +>C : C + diff --git a/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts b/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts index 2ef95db01f..ece41012df 100644 --- a/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts +++ b/tests/cases/compiler/jsFileCompilationDecoratorSyntax.ts @@ -1,3 +1,4 @@ // @allowJs: true +// @noEmit: true // @filename: a.js @internal class C { } \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts index b71677554a..04dae8b592 100644 --- a/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts +++ b/tests/cases/fourslash/getJavaScriptSemanticDiagnostics21.ts @@ -4,12 +4,4 @@ // @Filename: a.js //// @internal class C {} -verify.getSemanticDiagnostics(`[ - { - "message": "'decorators' can only be used in a .ts file.", - "start": 0, - "length": 9, - "category": "error", - "code": 8017 - } -]`); \ No newline at end of file +verify.getSemanticDiagnostics(`[]`);