I am new to both TypeScript and Babel. I have researched both and found they have features the other does not have. I'd like get the best of both world by using TypeScript to organize my code then use babels ES6 features like asyc/await and others. Is this possible.
I'd like get the best of both world by using TypeScript to organize my code then use babels ES6 features like asyc/await and others. Is this possible.
Not out of the box. I would recommend against it unless you are willing to start compiler hacking yourself. Reason is that since TypeScript doesn't understand async await yet you need to put babel before TypeScript and then the output generated by Babel will not be ideal TypeScript compilation target.
That said TypeScript should get async/await soon (3 / 4 months)
You can now use TypeScript async/await
with --target es6
and then use babel as a secondary transpiler.
In fact atom-typescript supports typescript -> babel -> js
out of the box : https://github.com/TypeStrong/atom-typescript/blob/master/docs/faq.md#can-i-use-an-alternate-transpiler
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.