-
-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(typescript): upgrade target from es2017 to es2021 #1987
Conversation
Do we need to change it for all packages at once ? |
Why not? What advantages and disadvantages do we have if we change it for all packages or specific packages? |
If the generated JS is different (even for a tiny bit), we would need to release a new version, and i’m not fan of new versions without features |
There is no problem with releasing minor versions 🤔 |
But still .... can we or is it annoying ? it's a genuine question ^^ |
Humm I am not sure if we can do that. I am think about people using a UX component, in a custom webpack configuration, I think this could break for them. |
@@ -1,11 +1,18 @@ | |||
import { Controller } from '@hotwired/stimulus'; | |||
|
|||
class default_1 extends Controller { | |||
app; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why only the controller have changed and not other .js files (example in Svelte folder) ?
tsconfig.json
Outdated
@@ -7,7 +7,7 @@ | |||
"rootDir": "src", | |||
"strict": true, | |||
"strictPropertyInitialization": false, | |||
"target": "es2017", | |||
"target": "es2022", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea if what i'm asking there is stupid tbh ^^
But should we update the rest of these options, like
"lib": ["dom", "es2015"],
"module": "es2015",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target
already modify lib
setting, but module
is another setting not related to lib or target
They still can run Babel/core-js on node_modules/, but yeah that should be told explicitly. PS: To me, in an ideal world, JavaScript packages should only contains source files and the user is responsible for building them. |
I think (as of today, no hard stance) the opposite. Well, i think like you and also the opposite 😅
That a very intersting debate, probably deserve a new issue for it :) |
@Kocal can you post here a small objective list of what the impacts are / can be. Regarding ES2022 i checked on caniuse.com and i'm 100% for, but... We need prepare this with:
I'm not sure if this could be considered BC break ... in a pragmatic sense. |
That allow me to reintroduce an idea that stayed in my head for too long: we need an "official" / public / clear browser compatibility list. And i don't think this can be the same as the Symfony php (no one can honestly garantee total browser support for 5 years, and we don't have multiple versions at once for the moment). That aslo would require an entire debate/issue. |
Update: i'd like to avoid "static class initialization" as they are not compatible with 2 or 3 years old iPhones :| Can we pick a subset of features ? -> https://caniuse.com/mdn-javascript_classes_static_initialization_blocks |
I don't really think... :/ Maybe with Anyway, if we wan't to keep classes definition as-if in |
Would ES2020 / ES2021 be good for you ? It seems to match your needs and has a much better support table for now. |
Good for me, but you will still have the Microsoft license in Autocomplete dist code 😛 |
I've downgraded to ES2020 to keep tslib's helpers for class private members, and finally upgraded to ES2021 (it has no effect on the code yet). |
I am not 100% about it! Can we create separate branch for people that wan't to use more recent ES version? And just keep the main branch as it is now, and merge during a major version ? |
I mean, for the code actually present in the code base, if I use |
This PR is now using I believe we can merge this safely :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
e57b0b7
to
ca94369
Compare
Thanks Hugo. |
We are in 2024, but we still targets ES2017 which requires TypeScript to import some helper functions (to handle
const {a, ...b} = c
and private class methods), which then ship Microsoft license (cc #1937 (comment)).Since those
dist/
files are:importmap
support (if a browser supportsimportmap
, it supports rest operator and private class methods)IMO we can configure an highest TypeScript target. We will have the following benefits:
dist
filesWDYT?