You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ babel index.tsx
TypeError: /home/michael/git/babel-prop-types-issue/index.tsx: Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got undefined
at Object.validate (/home/michael/git/babel-prop-types-issue/node_modules/@babel/types/lib/definitions/utils.js:132:11)
at validateField (/home/michael/git/babel-prop-types-issue/node_modules/@babel/types/lib/validators/validate.js:24:9)
at validate (/home/michael/git/babel-prop-types-issue/node_modules/@babel/types/lib/validators/validate.js:17:3)
at builder (/home/michael/git/babel-prop-types-issue/node_modules/@babel/types/lib/builders/builder.js:38:27)
at Object.assignmentExpression (/home/michael/git/babel-prop-types-issue/node_modules/@babel/types/lib/builders/generated/index.js:260:31)
at remove (/home/michael/git/babel-prop-types-issue/node_modules/babel-plugin-transform-react-remove-prop-types/lib/remove.js:77:54)
at ClassProperty (/home/michael/git/babel-prop-types-issue/node_modules/babel-plugin-transform-react-remove-prop-types/lib/index.js:253:37)
at NodePath._call (/home/michael/git/babel-prop-types-issue/node_modules/@babel/traverse/lib/path/context.js:55:20)
at NodePath.call (/home/michael/git/babel-prop-types-issue/node_modules/@babel/traverse/lib/path/context.js:42:17)
at NodePath.visit (/home/michael/git/babel-prop-types-issue/node_modules/@babel/traverse/lib/path/context.js:92:31) {
code: 'BABEL_TRANSFORM_ERROR'
}
The text was updated successfully, but these errors were encountered:
The above code is however valid TypeScript, first only declaring the member and its type, then assigning its value later. When migrating our codebase to TypeScript, this was the minimal change required to make TypeScript happy about the prop types.
Code (TypeScript):
Config:
throws the error
The text was updated successfully, but these errors were encountered: