-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Support browsers from before 2020 #4579
Conversation
As reported in #2825, #2826 and #3051, almost everything works in older browsers. This setting here prevented me from updating and I think it is an obvious enhancement to not restrict to browsers from 2020+. There should not be any measurable downsides of this change since es6 and es2020 are pretty similar with only minor differences.
@code-asher I can't think of any downsides to this, can you? 🤔 |
I guess upstream vscode uses es2020 as the target, so one risk is that divergence means that the result may not be as well-tested. I don't know enough to have an accurate assessment of the risk though. |
Great point! I'm guessing we decided to use |
We can change our target but code-server will still not work since VS
Code has their own target. I am not sure we even have any of our own
client-side JavaScript anymore in 4.0.0.
|
Ah right! This would have to be in VS Code itself (or in our fork). But if we change in our fork, that would diverge from upstream and could cause other issues.
Wow, you're right. I didn't even realize that. |
Between es6 and es2020, there are no interoperability risks. In this case, they only differ in syntactic sugar like |
What about the forked repository? Isn't that deemed "our own"?
Yeah, we diverge in one global setting but TypeScript guarantees that older targets are still working properly and being compatible to newer code... I think code-server has a selling point in being more compatible than upstream. Microsoft does not care about a few individuals that diverge from mainstream for some reason. We have the chance to continue to not go that route with probably very low effort. |
VS Code is compiled separately using their build process so our tsconfig
has no effect on it.
But if we patch it there instead and everything works that seems like a
win to me.
We could also leave this change here as well in case we ever add
client-side JavaScript again.
Our tests are reporting the following with this change:
```
test/unit/node/cli.test.ts:91:11 - error TS2550: Property 'flat' does not exist on type '(string | string[])[]'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2019' or later
```
So maybe we also need to add `lib`.
|
Yes, sure. Those are polyfills so that beside syntax change, also new methods work in older browsers. 😉 |
Good point! I agree. @code-asher should we ask @L3P3 to submit a PR to our fork here?
Agreed. As long as the build passes, I think we're okay to merge. |
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.
Even though we don't have any client-side JS in code-server at the moment, we're okay merging this in, in case we do want to support older browser in the future.
Thanks @L3P3 for adding this 👍
P.S. you can ignore this. It's a known issue that I need to fix. |
Sounds great. Done. Lets hope it compiles successfully. 🙈 |
BTW if anyone wonders why they targeted es2020 in the first place: They use electron which is pretty much latest chrome. Web development and electron development has some differences. 😉 |
FAIL test/unit/node/routes/login.test.ts
● Test suite failed to run
test/unit/node/routes/login.test.ts:81:9 - error TS2322: Type 'URLSearchParams' is not assignable to type 'BodyInit | undefined'.
Type 'URLSearchParams' is missing the following properties from type 'URLSearchParams': entries, keys, values, [Symbol.iterator]
81 body: params,
~~~~ Hmm... looks like one of the tests are failing. You might need to look into fixing |
I still see the same error in the test here. We'll push this for the next release. |
Sorry, I thought that dom includes dom.iterable but it appears to not be the case. Just another try and hopefully no error. 🙈 |
Codecov Report
@@ Coverage Diff @@
## main #4579 +/- ##
==========================================
- Coverage 66.14% 66.10% -0.04%
==========================================
Files 30 30
Lines 1654 1658 +4
Branches 331 337 +6
==========================================
+ Hits 1094 1096 +2
- Misses 475 477 +2
Partials 85 85
Continue to review full report at Codecov.
|
@code-asher tested this yesterday and I think it should be okay to merge after 4.0.0 is out! |
As reported in #2825, #2826 and #3051, almost everything works in older browsers. This setting here prevented me from updating and I think it is an obvious enhancement to not artificially restrict to browsers from 2020+. There should not be any noticable downsides of this change since es6 and es2020 are pretty similar with only minor differences.