script Error: did not recognize object of type "PropertyDefinition"
See original GitHub issueI am trying to run an upgrade of material UI from v4 to v5 and am getting an error:
ERR .../index.js Transformation error (did not recognize object of type "PropertyDefinition")
Error: did not recognize object of type "PropertyDefinition"
at Object.getFieldNames (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/types.js:660:19)
at visitChildren (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:184:36)
at Visitor.PVp.visitWithoutReset (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:166:20)
at NodePath.each (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path.js:87:26)
at visitChildren (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:178:18)
at Visitor.PVp.visitWithoutReset (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:166:20)
at visitChildren (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:203:25)
at Visitor.PVp.visitWithoutReset (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:166:20)
at visitChildren (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:203:25)
at Visitor.PVp.visitWithoutReset (/Users/jennykortina/.npm/_npx/60603/lib/node_modules/@mui/codemod/node_modules/ast-types/lib/path-visitor.js:166:20)
index.js looks like:
// @flow
import React, { Component } from 'react';
import withStyles from '@mui/styles/withStyles';
import Typography from '@mui/material/Typography/Typography';
import { sharedStyles } from './sharedStyles';
import type { ClassesObject } from 'helpers/unsafeTypes';
type P = {
classes: ClassesObject,
};
type S = {
saving: boolean,
errorMessage: string,
};
const styles = (theme) => ({
link: {
color: 'rgba(0, 0, 0, 0.87)',
display: 'flex',
textDecoration: 'none',
margin: '0 2rem',
},
linkImg: {
height: '20px',
marginRight: '.5rem',
},
linksWrapper: {
background: 'white',
boxShadow: '0 0 5px #ccc',
display: 'flex',
justifyContent: 'center',
marginTop: '3rem',
padding: '2rem',
},
pageWrapper: {
width: '800px',
textAlign: 'center',
},
});
class Verify extends Component<P, S> {
constructor(props: P) {
super(props);
this.state = {
saving: false,
errorMessage: '',
};
}
render() {
const { classes } = this.props;
return (
<div className={classes.pageWrapper}>
<Typography style={sharedStyles.title} variant="h5" color="secondary" component="h2">
Check your email for a link.
</Typography>
<Typography className={classes.subTitle} variant="h6" component="h3">
We’ve sent a verification link to you. This is how we keep your data safe.
</Typography>
<div className={classes.linksWrapper}>
<a target="noopener noreferrer" className={classes.link} href="https://mail.google.com">
<img
className={classes.linkImg}
src='/img/sign-up/gmail.png'
/>
Open Gmail
</a>
<a
target="noopener noreferrer"
className={classes.link}
href="https://outlook.office.com/mail/inbox">
<img
className={classes.linkImg}
src='/img/sign-up/outlook.png'
/>
Open Outlook
</a>
</div>
</div>
);
}
}
export default withStyles(styles)(Verify);
i opened a ticket on the material UI page but they think it’s a bug in jscodeshift, which I also think based on this ticket
i am trying to use this codemod npx @mui/codemod v5.0.0/preset-safe ./ --parser=flow
any help would be appreciated thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
v4 to v5 upgrade script Error: did not recognize object of type ...
Have a react project with version 4 of material ui, and be using flow; run the codemod script npx @mui/codemod v5.0.0/preset-safe ./ --parser ......
Read more >Dealing with "Object '....' not found" script errors
Identify timing problems¶. First, determine whether the error is caused by a timing issue or not. Is the error thrown by a call...
Read more >Object type is not recognized sometimes - Stack Overflow
Here we have a value, bar , known to have a b property. We can assign bar to foo because bar is a...
Read more >JavaScript data types and data structures - MDN Web Docs
Note: It's important to recognize it's accessor property — not accessor method. We can give a JavaScript object class-like accessors by ...
Read more >Add-Member (Microsoft.PowerShell.Utility) - Microsoft Learn
Not all objects have every type of member. If you specify a member type that the object doesn't have, PowerShell returns an error....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If someone who’s still experiencing the bug can set up and configure a project on a git repository that reproduces the bug and where all I have to do is do a git clone, npm install, and npm whatever command (npm start, npm foo, etc) to reproduce the bug, then this is something I can look into.
It is not fixed and a fix would be greatly appreciated!