tslib
tslib copied to clipboard
fix(__extends): Use correct behaviour with `null` prototype
If you were to call __extends(Foo, null), it would cause incorrect behaviour for extendStatics, as Foo is supposed to inherit from %Function.prototype% in that case, instead of also inheriting from null.
Does this change relate to a change in Typescript? Or should there be a change there?
There should also be a change in TypeScript.
Apparently "correct" behavior when extending null is up for debate. The algorithms in the ECMA-262 specification related to extends null actually prevent it from working, and no engine currently supports extends null. The last time the behavior was discussed in plenary was last October and the conclusion was that more time is needed to explore solutions.
Until this has been resolved in the specification, I'd rather not make any more changes to extends null semantics in TypeScript. Until then, I plan to leave this PR open so that we can come back to it once the specification issues have been resolved.