Closed FrancescElies closed 1 year ago
This is an interesting one. Cycling '74 don't make it clear exactly what engine they are running in the [js] object, and they do have a number of es6 functions implemented from what I can tell, although not all! It's a bit of polyfill roulette in my experience, so I'm not actually sure if es5 or es6 is better. I've made a number of fairly complex projects with lib set to es6 though and not had any huge issues. You would be very welcome to do the research to conclusively prove which would be best though if you're prepared to spend the time on it! Hopefully in future we might get a version of max with a newer js engine, but that's complete conjecture at this point as they've been pretty tight lipped on what plans they have.
The only thing I can tell is what I read here. The following answer coming from what I believe is a dev @Cycling74 (not 100% sure about that).
Maybe we could ask in this typescript thread?
I've seen that post before but I have to say that if I targeted ES5 with Typescript I had problems, which is why I "target": "ES3"
now in all my projects. However changing to "lib": ["ES5"]
may well make sense if we can validate that nothing is broken by doing so. It should not be though as essentially we are just using this to make sure the DOM declarations are not included.
Interestingly enough I also discovered that you may need to actually do
"lib": [
"ES6",
"es2017.object"
]
depending on what you include in your project. See https://github.com/twhiston/tw.gl.repl for an example of this.
I tried to rebuild my latest feature branch of the above project with "lib": ["ES5"]
instead of what I said above and at first glance it seems like it works. I'll try to give it a complete run through of all the functionality later as that's probably the most complex bit of max typescript I have, but I'm coming around to the idea that ES5
might be the right call here.
I ran a load of tests on this and it seems lib and target set to es5 seems to work in every case, so I have updated the examples and the README. Thanks very much for pointing this out and compelling me to do some more digging into it
Here I read the following.
Both points make sense to me, but when I read tsconfig#lib docs shouldn't lib be es5 instead of es6?
What am I missing?