question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

script Error: did not recognize object of type "PropertyDefinition"

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
ElonVolocommented, May 12, 2022

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.

1reaction
jennykortinacommented, Mar 12, 2022

It is not fixed and a fix would be greatly appreciated!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found