tslib icon indicating copy to clipboard operation
tslib copied to clipboard

fix(__decorate): Stop using non‑standard `Reflect.decorate`

Open ExE-Boss opened this issue 4 years ago • 1 comments

TypeScript PR: https://github.com/microsoft/TypeScript/pull/36408

Reflect.decorate is not on a standards track and has no active proposal being championed in TC39. We have no idea if Reflect.decorate will get added to the language, even if it does, we have no guarantee it will be the implementation we are assuming it to be.

By having this condition in the code, we are likely preventing Reflect.decorate from ever existing in the language, just like Array.prototype.flatten had to get a different name because MooTools would attempt to use it if it existed and it was not the implementation MooTools assumed it would be.

Here is a W3C TAG finding which recommends against usage of speculative features -- https://www.w3.org/2001/tag/doc/polyfills/#don-t-use-speculative-polyfills-that-defer-to-native-implementations

ExE-Boss avatar Jan 19 '21 09:01 ExE-Boss

Nice work @ExE-Boss ☺️

JakeChampion avatar Mar 11 '22 11:03 JakeChampion