First of all sorry that the title makes no sense. Here's what I'm dealing with plus a TL;DR at the end.
I'm using the tslib library from Microsoft, here's the full source code for context. I needed to make some minor adjustments to the library to make it work with my project so I copy-pasted the code to a file and edited it there. The modified code works with a React project I was working on earlier but it breaks with React Native because of these lines:
(function (exporter) {
// some irrelevant stuff
__extends = function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
});
(I didn't modify this part, you can find it on line 66 in the original source code)
When React Native tries to compile this to native code it breaks with the error message
Prototype value can only be an object or null
with the error coming out of the __extends = function(d, b) {
assignment.
So I somehow need to convert that inner anonymous function into an object, the problem is even though I've been working with JavaScript for ages, I genuinely have no clue what this code is supposed to do. I'm an ES6+ guy, this stuff is like Egyptian hieroglyphs to me. Could some of you JS veterans come over and save me please?
TL;DR: I somehow need to convert __extends = fuction() {}
to an object that would do the same thing as the function.