microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.25k stars 126 forks source link

Add __generator helper to es6 source and populate jsnext:main #5

Closed frankwallis closed 7 years ago

frankwallis commented 7 years ago

This enables support for using the importHelpers option with module: 'es6' and then bundling the output with rollup, which automatically strips out any unused helper functions.

dmitrage commented 7 years ago

There is also __extends helper missing in tslib.es6.js. See my issue https://github.com/Microsoft/TypeScript/issues/9980.

Rollup also supports module field in package.json similar to jsnext:main.

Is there any reason why "export const" but not "export var" is used? All other code is ES5.

frankwallis commented 7 years ago

@dmitrage I have just added the __extends helper as well. Will wait for feedback on the const/var issue.

nathanhammond commented 7 years ago

Ember CLI also would benefit from adding the __extends functionality into tslib.es6.js. We have a mild preference toward export var, but can use it in either way.

imcotton commented 7 years ago

/ping @mhegazy @rbuckton

This could be really useful, please have another look, thanks.

frankwallis commented 7 years ago

@imcotton, @dmitrage I have added the module field to package.json

frankwallis commented 7 years ago

@mhegazy - I have refreshed this PR with the latest changes, can it now be merged?

frankwallis commented 7 years ago

@mhegazy - thank you

imcotton commented 7 years ago

@mhegazy Thank you, btw could we anticipate that npm version includes this PR going to publish soon?