Allow decorators in JavaScript files
This commit is contained in:
parent
977adde2ff
commit
f601e6dd76
|
@ -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
|
||||
|
|
|
@ -1168,9 +1168,6 @@ namespace ts {
|
|||
let typeAssertionExpression = <TypeAssertion>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);
|
||||
|
|
|
@ -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.
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/compiler/a.js ===
|
||||
@internal class C { }
|
||||
>C : Symbol(C, Decl(a.js, 0, 0))
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/compiler/a.js ===
|
||||
@internal class C { }
|
||||
>internal : any
|
||||
>C : C
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
// @allowJs: true
|
||||
// @noEmit: true
|
||||
// @filename: a.js
|
||||
@internal class C { }
|
|
@ -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
|
||||
}
|
||||
]`);
|
||||
verify.getSemanticDiagnostics(`[]`);
|
||||
|
|
Loading…
Reference in a new issue