-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Out of ScopeThis idea sits outside of the TypeScript language design constraintsThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Motivation:
TypeScript currently doesn't support all ES6 features and it takes time for supporting them.
Moreover each vendor plays with new ES extensions like ES7 draft and so on.
Proposal:
Allow pure ECMAScript block which is not treated as TypeScript.
It is pretty similar to '_asm' directive in C language.
This allows to use generators of ES6 while TS doesn't support them:
__ecmascript {
function *foo() {
yield 1;
}
}
// Since the block is not parsed by the TS compiler we must declare the function.
declare extern foo() : any;
var it = foo();
var value = it.next();
Or 'const' which is not supported in TS 1.3:
__ecmascript {
const A = 1;
}
// Declaring 'A' to be used in the code.
// TS compiler doesn't protect us from assigning to 'A' but ES engine does.
declare var A : number;
Metadata
Metadata
Assignees
Labels
Out of ScopeThis idea sits outside of the TypeScript language design constraintsThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScriptAn idea for TypeScript