-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed as not planned
Labels
ES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)SuggestionAn idea for TypeScriptAn idea for TypeScriptWaiting for TC39Unactionable until TC39 reaches some conclusionUnactionable until TC39 reaches some conclusion
Description
Support proposal-throw-expressions.
That proposal is now stage-1, but worth to implements for convenience and this proposal not break backward-compatibilities.
Current
ts
const errorThrowExp = () => { throw new Error('Error!'); }
function errorThrowFn(maybeTrue) {
if (maybeTrue){
return ...;
} else {
throw new Error('Error!');
}
}
js
const errorThrowExp = function() {throw new Error('Error!')}
function errorThrowFn(maybeTrue) {
if (maybeTrue){
return ...;
} else {
throw new Error('Error!');
}
}
Proposal
ts
const errorThrower = () => throw new Error('Error!');
function errorThrowFn(maybeTrue: boolean) {
return maybeTrue? ...: throw new Error('Error!');
}
js
const errorThrower = function() { throw new Error('Error!'); }
function errorThrowFn(maybeTrue: boolean) {
return maybeTrue? ...: (function() { throw new Error('Error!') })();
}
haltcase, recmo, chillitom, smmoosavi, gbersac and 1 more
Metadata
Metadata
Assignees
Labels
ES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)SuggestionAn idea for TypeScriptAn idea for TypeScriptWaiting for TC39Unactionable until TC39 reaches some conclusionUnactionable until TC39 reaches some conclusion