Skip to content

Commit edae7c3

Browse files
committed
Merge pull request #7096 from Microsoft/port6881
Port fix to allow decorators in JavaScript
2 parents ddc0778 + a972a6f commit edae7c3

17 files changed

+195635
-194557
lines changed

lib/tsc.js

Lines changed: 34694 additions & 34476 deletions
Large diffs are not rendered by default.

lib/tsserver.js

Lines changed: 47976 additions & 47748 deletions
Large diffs are not rendered by default.

lib/typescript.d.ts

Lines changed: 2304 additions & 2305 deletions
Large diffs are not rendered by default.

lib/typescript.js

Lines changed: 54166 additions & 53845 deletions
Large diffs are not rendered by default.

lib/typescriptServices.d.ts

Lines changed: 2304 additions & 2305 deletions
Large diffs are not rendered by default.

lib/typescriptServices.js

Lines changed: 54166 additions & 53845 deletions
Large diffs are not rendered by default.

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12827,7 +12827,7 @@ namespace ts {
1282712827
}
1282812828

1282912829
if (!compilerOptions.experimentalDecorators) {
12830-
error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning);
12830+
error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
1283112831
}
1283212832

1283312833
if (compilerOptions.emitDecoratorMetadata) {

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@
679679
"category": "Error",
680680
"code": 1218
681681
},
682-
"Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.": {
682+
"Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.": {
683683
"category": "Error",
684684
"code": 1219
685685
},
@@ -2607,11 +2607,6 @@
26072607
"category": "Error",
26082608
"code": 8016
26092609
},
2610-
"'decorators' can only be used in a .ts file.": {
2611-
"category": "Error",
2612-
"code": 8017
2613-
},
2614-
26152610
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
26162611
"category": "Error",
26172612
"code": 9002

src/compiler/program.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,9 @@ namespace ts {
828828
diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
829829
return true;
830830
case SyntaxKind.Decorator:
831-
diagnostics.push(createDiagnosticForNode(node, Diagnostics.decorators_can_only_be_used_in_a_ts_file));
831+
if (!options.experimentalDecorators) {
832+
diagnostics.push(createDiagnosticForNode(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
833+
}
832834
return true;
833835
}
834836

tests/baselines/reference/generatorTypeCheck39.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(5,16): error TS1163: A 'yield' expression is only allowed in a generator body.
2-
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(6,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.
2+
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(6,11): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
33
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(7,13): error TS1163: A 'yield' expression is only allowed in a generator body.
44

55

@@ -13,7 +13,7 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck39.ts(7,13): erro
1313
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
1414
class C {
1515
~
16-
!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.
16+
!!! error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
1717
x = yield 0;
1818
~~~~~
1919
!!! error TS1163: A 'yield' expression is only allowed in a generator body.

0 commit comments

Comments
 (0)