mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 19:27:35 -06:00
Adds an --experimentalThrowExpressions flag
This commit is contained in:
parent
043e7e9e02
commit
3a96b18910
@ -17179,6 +17179,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkThrowExpression(node: ThrowExpression): Type {
|
||||
if (!compilerOptions.experimentalThrowExpressions) {
|
||||
error(node, Diagnostics.Experimental_support_for_throw_expressions_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalThrowExpressions_option_to_remove_this_warning);
|
||||
}
|
||||
|
||||
checkExpression(node.expression);
|
||||
return neverType;
|
||||
}
|
||||
|
||||
@ -433,6 +433,12 @@ namespace ts {
|
||||
category: Diagnostics.Experimental_Options,
|
||||
description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
|
||||
},
|
||||
{
|
||||
name: "experimentalThrowExpressions",
|
||||
type: "boolean",
|
||||
category: Diagnostics.Experimental_Options,
|
||||
description: Diagnostics.Enables_experimental_support_for_ECMAScript_Stage_2_throw_expressions
|
||||
},
|
||||
|
||||
// Advanced
|
||||
{
|
||||
|
||||
@ -907,6 +907,10 @@
|
||||
"category": "Error",
|
||||
"code": 1328
|
||||
},
|
||||
"Experimental support for 'throw' expressions is a feature that is subject to change in a future release. Set the 'experimentalThrowExpressions' option to remove this warning.": {
|
||||
"category": "Error",
|
||||
"code": 1329
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
@ -3314,6 +3318,11 @@
|
||||
"category": "Message",
|
||||
"code": 6185
|
||||
},
|
||||
"Enables experimental support for ECMAScript Stage-2 'throw' expressions.": {
|
||||
"category": "Message",
|
||||
"code": 6186
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
"code": 7005
|
||||
|
||||
@ -3658,6 +3658,7 @@ namespace ts {
|
||||
emitBOM?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
experimentalThrowExpressions?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
/*@internal*/help?: boolean;
|
||||
importHelpers?: boolean;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2015
|
||||
// @experimentalThrowExpressions: true
|
||||
declare const condition: boolean;
|
||||
const a = condition ? 1 : throw new Error();
|
||||
const b = condition || throw new Error();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: esnext
|
||||
// @experimentalThrowExpressions: true
|
||||
declare const condition: boolean;
|
||||
const a = condition ? 1 : throw new Error();
|
||||
const b = condition || throw new Error();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user