-
Notifications
You must be signed in to change notification settings - Fork 722
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
internal: upgrade to TypeScript ^5.7.0 #1894
base: master
Are you sure you want to change the base?
Conversation
@@ -80,6 +80,7 @@ module.exports = { | |||
'error', | |||
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'allow-as-parameter' }, | |||
], | |||
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }], |
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.
enabled auto-fixing import { FooType } from './foo'
to import type { FooType } from './foo'
which TS now cares about
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.
Typescript should not require this afaik unless verbatimModuleSyntax
is enabled 🤔
But it's a good practice anyway, so 👍
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 think I was getting *.d.ts is not a module
errors, but actually fixed that in tsconfig with "moduleResolution": "node16"
but agree this is best practice/we should do it anyway 👍
@@ -6,7 +6,7 @@ | |||
"scripts": { | |||
"build": "next build && next export", | |||
"deploy": "rm -rf out && yarn build && cd out && touch .nojekyll && git init && git add . && git commit -m \"Deploy commit\" && git remote add origin [email protected]:airbnb/visx.git && git push -f origin master:gh-pages", | |||
"dev": "next", | |||
"dev": "NODE_OPTIONS=--openssl-legacy-provider next", |
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.
may need to update next, minimally need to add this same option to the build. don't fully understand why there is an error without this, because our version of next should be using webpack 5 by default 🤔
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've tried to upgrade next to the latest version using npx @next/codemod upgrade
back when I made #1889 in an attempt to verify all components with react 19, but when I tried react-docgen-typescript-loader
did not work anymore (everything else did though), so I didn't continue working on it.
I can try again in the next few days based on this branch, maybe some other dependency upgrade made it work in the meantime, or maybe there is an easy replacement for that dependency...
import type { OrientationType } from '../constants/orientation'; | ||
import Orientation from '../constants/orientation'; |
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.
FYI, instead of splitting those lines up you can also do this:
import type { OrientationType } from '../constants/orientation'; | |
import Orientation from '../constants/orientation'; | |
import Orientation, { type OrientationType } from '../constants/orientation'; |
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.
had just used the eslint autofix here. this doesn't seem to be configurable https://typescript-eslint.io/rules/consistent-type-imports/. no strong opinion from me.
Size Changes
View raw build statsPrevious (master){
"visx-annotation": {
"esm": 30333,
"lib": 40419
},
"visx-axis": {
"esm": 20709,
"lib": 25153
},
"visx-bounds": {
"esm": 2661,
"lib": 3136
},
"visx-brush": {
"esm": 55492,
"lib": 59763
},
"visx-chord": {
"esm": 3301,
"lib": 4484
},
"visx-clip-path": {
"esm": 3993,
"lib": 5491
},
"visx-curve": {
"esm": 323,
"lib": 1462
},
"visx-delaunay": {
"esm": 2422,
"lib": 3231
},
"visx-demo": {
"esm": 0,
"lib": 36814
},
"visx-drag": {
"esm": 12570,
"lib": 14176
},
"visx-event": {
"esm": 3815,
"lib": 5091
},
"visx-geo": {
"esm": 12930,
"lib": 16196
},
"visx-glyph": {
"esm": 13761,
"lib": 18476
},
"visx-gradient": {
"esm": 16078,
"lib": 20593
},
"visx-grid": {
"esm": 18097,
"lib": 21710
},
"visx-group": {
"esm": 1471,
"lib": 2070
},
"visx-heatmap": {
"esm": 7040,
"lib": 8347
},
"visx-hierarchy": {
"esm": 12093,
"lib": 17820
},
"visx-legend": {
"esm": 25546,
"lib": 32474
},
"visx-marker": {
"esm": 8204,
"lib": 10332
},
"visx-mock-data": {
"esm": 326036,
"lib": 329336
},
"visx-network": {
"esm": 4497,
"lib": 6572
},
"visx-pattern": {
"esm": 11689,
"lib": 15673
},
"visx-point": {
"esm": 1003,
"lib": 1781
},
"visx-react-spring": {
"esm": 13253,
"lib": 16586
},
"visx-responsive": {
"esm": 15936,
"lib": 18296
},
"visx-sankey": {
"esm": 3543,
"lib": 4594
},
"visx-scale": {
"esm": 18870,
"lib": 29896
},
"visx-shape": {
"esm": 81766,
"lib": 102573
},
"visx-stats": {
"esm": 13498,
"lib": 15050
},
"visx-text": {
"esm": 8276,
"lib": 9773
},
"visx-threshold": {
"esm": 2844,
"lib": 3723
},
"visx-tooltip": {
"esm": 14383,
"lib": 19715
},
"visx-vendor": {
"esm": 2492,
"lib": 2702
},
"visx-visx": {
"esm": 1524,
"lib": 4155
},
"visx-voronoi": {
"esm": 2137,
"lib": 2824
},
"visx-wordcloud": {
"esm": 2506,
"lib": 3311
},
"visx-xychart": {
"esm": 173440,
"lib": 225481
},
"visx-zoom": {
"esm": 16176,
"lib": 18872
}
} Current{
"visx-annotation": {
"esm": 30333,
"lib": 40419
},
"visx-axis": {
"esm": 20709,
"lib": 25153
},
"visx-bounds": {
"esm": 2662,
"lib": 3136
},
"visx-brush": {
"esm": 55698,
"lib": 59969
},
"visx-chord": {
"esm": 3301,
"lib": 4484
},
"visx-clip-path": {
"esm": 3993,
"lib": 5491
},
"visx-curve": {
"esm": 323,
"lib": 1462
},
"visx-delaunay": {
"esm": 2422,
"lib": 3231
},
"visx-demo": {
"esm": 0,
"lib": 0
},
"visx-drag": {
"esm": 12570,
"lib": 14176
},
"visx-event": {
"esm": 3815,
"lib": 5091
},
"visx-geo": {
"esm": 12930,
"lib": 16196
},
"visx-glyph": {
"esm": 13761,
"lib": 18476
},
"visx-gradient": {
"esm": 16078,
"lib": 20593
},
"visx-grid": {
"esm": 18097,
"lib": 21710
},
"visx-group": {
"esm": 1471,
"lib": 2070
},
"visx-heatmap": {
"esm": 7040,
"lib": 8347
},
"visx-hierarchy": {
"esm": 12093,
"lib": 17820
},
"visx-legend": {
"esm": 25546,
"lib": 32474
},
"visx-marker": {
"esm": 8204,
"lib": 10332
},
"visx-mock-data": {
"esm": 326036,
"lib": 329336
},
"visx-network": {
"esm": 4497,
"lib": 6572
},
"visx-pattern": {
"esm": 11689,
"lib": 15673
},
"visx-point": {
"esm": 1003,
"lib": 1781
},
"visx-react-spring": {
"esm": 13253,
"lib": 16586
},
"visx-responsive": {
"esm": 15936,
"lib": 18296
},
"visx-sankey": {
"esm": 3543,
"lib": 4594
},
"visx-scale": {
"esm": 18891,
"lib": 29917
},
"visx-shape": {
"esm": 81787,
"lib": 102594
},
"visx-stats": {
"esm": 13498,
"lib": 15050
},
"visx-text": {
"esm": 8297,
"lib": 9794
},
"visx-threshold": {
"esm": 2844,
"lib": 3723
},
"visx-tooltip": {
"esm": 14383,
"lib": 19715
},
"visx-vendor": {
"esm": 2492,
"lib": 2702
},
"visx-visx": {
"esm": 1524,
"lib": 4155
},
"visx-voronoi": {
"esm": 2137,
"lib": 2824
},
"visx-wordcloud": {
"esm": 2506,
"lib": 3324
},
"visx-xychart": {
"esm": 174826,
"lib": 225920
},
"visx-zoom": {
"esm": 16176,
"lib": 18872
}
} |
everything is good except the typescript -> docs is broken. may not land this until after the holidays. |
I briefly tried to look into fixing the docs and wrote everything down in #1897. |
🏠 Internal
Working toward
react@19
(#1883), this PRreact@19
usesqueueMicrotask
which is not supported by our 5 year old version of jest3.8
to5.7
because upgradingjest
dependencies couldn't compile@typescript-eslint/eslint-plugin
so we can use@typescript-eslint/consistent-type-imports
to auto fiximport type { FooType } from './foo';
required inTypeScript@^5.4
@react-spring/web
peer deps to^9.7.5
which should fix TypeError: (0 , _web.useTransition) is not a function #1725node >= 16.13.0
tonode >= 18.8.0
@visx/xychart
'swithRegisteredData
HOC because the compiled types were so complex they became invalid (similar to [regression - 5.4] Generated.d.ts
file contains invalid types microsoft/TypeScript#57843)