microsoft / tslib

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

Update helpers to use redefining pattern if needed (related to Micros… #54

Closed Andarist closed 6 years ago

Andarist commented 6 years ago

…oft/TypeScript#24244)

Updated according to merged changes in https://github.com/Microsoft/TypeScript/pull/24244

Didn't update CJS file because of it's lack of live bindings - which is relevant for __assign. As it's UMD bundle it won't be tree-shaken anyway, so I've skipped updating it.

mhegazy commented 6 years ago

@rbuckton can you please review and merge?

Andarist commented 6 years ago

cc @DanielRosenwasser , would love a new release with this 😉

DanielRosenwasser commented 6 years ago

Done. Thanks!

sabberworm commented 4 years ago

We polyfill Object.assign with _assign. The update to tslib 1.9.3 broke this pattern because by the time the new wrapper function is executed, Object.assign will point to __assign, which means it will loop endlessly. I think our usage was wonky at best and I’m not opposed to this change at all but I think a breaking change like this should have warranted a new major version.

(sorry I’m venting a bit because this took me hours to track down)

Andarist commented 4 years ago

Well, this was very hard to predict - tslib was not intended to serve as polyfill for built-ins. I wouldn't classify this as a breaking change, especially given the fact that this was released 2 years ago and you are the first person to report such a problem.