Closed gvidaver closed 4 hours ago
Hey @gvidaver could you tell us what the content of /Users/go22670/Projects/kwicked2/src/components/transcript/Transcript.tsx
is?
Looks like the codemod struggles with modern typescript constructs, like satisfies
or instantiation expressions. Seeing it on the v7 migration in Toolpad as well
The reason migration on some of the recently introduced typescript constructs fails is the usage of the previous version of the jscodeshift
which doesn't support them, the bump to the latest version is blocked due to an issue with the underlying library.
We will try to have a workaround by pinning the dependencies to a previous version using yarn resolutions as suggested in https://github.com/facebook/jscodeshift/issues/534#issuecomment-1344735177
+1
the bump to the latest version is blocked due to an issue with the underlying library.
I see. Personally, that issue feels less of a problem to me than the typescript one. It can be easily solved on my end by running my formatter after the MUI codemod.
It's also not the only parentheses formatting problem with codemod. I ran into the following as well on the Toolpad codebase:
const x = () => ({ foo: 'bar' }) as Foo;
gets turned into
const x = () => ({ foo: 'bar' } as Foo);
The issue has been inactive for 7 days and has been automatically closed.
Reproductions for both cases:
import { GridColDef } from "@mui/x-data-grid";
// Transformation error (did not recognize object of type "TSSatisfiesExpression")
const cols = [] satisfies GridColDef[];
function makeBox<T>(value: T) {
return { value };
}
// Transformation error (did not recognize object of type "TSInstantiationExpression")
const makeStringBox = makeBox<string>;
const stringBox = makeStringBox("abc");
I see. Personally, that issue feels less of a problem to me than the typescript one. It can be easily solved on my end by running my formatter after the MUI codemod.
Agreed, perhaps the team could publish a canary with the upgrade on, that way those of us who use formatters can try the codemod and at least feed back on any other issues which come out the woodwork? Best case it works great alongside prettier and we can get upgraded!
Morning @MBilalShafi @Janpot was there any progress on this?
My team (Premium licences) is keen to upgrade, and can easily run prettier formatting afterwards, but the codemod crashing is a blocker as we have too many datagrids to migrate manually
:warning: This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@gvidaver: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.
Steps to reproduce
Link to live example: (required)
Gosh I wish I could give you a runnable example, but here's the log instead. Steps:
Current behavior
Throws an exception while running migration script. Seems to complete otherwise though.
Expected behavior
No exception.
Context
Running 7.0 migration script.
Your environment
``` System: OS: macOS 14.4 Binaries: Node: 21.7.1 - /usr/local/bin/node npm: 10.5.0 - /usr/local/bin/npm pnpm: Not Found Browsers: Chrome: 123.0.6312.59 Edge: Not Found Safari: 17.4 npmPackages: @emotion/react: ^11.11.3 => 11.11.3 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.35 @mui/core-downloads-tracker: 5.15.8 @mui/icons-material: ^5.15.7 => 5.15.7 @mui/joy: ^5.0.0-beta.26 => 5.0.0-beta.26 @mui/material: ^5.14.7 => 5.14.7 @mui/private-theming: 5.15.8 @mui/styled-engine: 5.15.8 @mui/system: 5.15.8 @mui/types: 7.2.13 @mui/utils: 5.15.8 @mui/x-data-grid: next => 6.19.2 @mui/x-data-grid-generator: next => 6.19.2 @mui/x-data-grid-premium: 6.19.2 @mui/x-data-grid-pro: 6.19.2 @mui/x-date-pickers: 6.19.2 @mui/x-date-pickers-pro: next => 6.19.2 @mui/x-license-pro: 6.10.2 @types/react: ^18.2.48 => 18.2.48 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.3.3 => 5.3.3 ```npx @mui/envinfo
Search keywords: TSInstantiationExpression Order ID: c74f7af5c579dc47e7ed444056faa516Tz03NzAwMCxFPTE3MjkzNjI5NDQwMDAsUz1wcm8sTE09c3Vic2NyaXB0aW9uLEtWPTI=