ant-design / codemod-v4

codemod cli for antd v4 upgrade
MIT License
94 stars 26 forks source link

Transformation error (Cannot read properties of undefined (reading 'type')) #234

Open joket1999 opened 1 year ago

joket1999 commented 1 year ago

报错信息:

ERR js/funcs.jsx Transformation error (Cannot read properties of undefined (reading 'type'))
TypeError: Cannot read properties of undefined (reading 'type')
    at ~/.nvm/versions/node/v18.17.1/lib/node_modules/@ant-design/codemod-v4/transforms/v3-Modal-method-with-icon-to-v4.js:98:30
    at Array.find (<anonymous>)
    at NodePath.<anonymous> (~/.nvm/versions/node/v18.17.1/lib/node_modules/@ant-design/codemod-v4/transforms/v3-Modal-method-with-icon-to-v4.js:96:50)
    at ~/.nvm/versions/node/v18.17.1/lib/node_modules/@ant-design/codemod-v4/node_modules/jscodeshift/src/Collection.js:75:36
    at Array.forEach (<anonymous>)
    at Collection.forEach (~/.nvm/versions/node/v18.17.1/lib/node_modules/@ant-design/codemod-v4/node_modules/jscodeshift/src/Collection.js:74:18)
    at NodePath.<anonymous> (~/.nvm/versions/node/v18.17.1/lib/node_modules/@ant-design/codemod-v4/transforms/v3-Modal-method-with-icon-to-v4.js:84:12)
    at ~/.nvm/versions/node/v18.17.1/lib/node_modules/@ant-design/codemod-v4/node_modules/jscodeshift/src/Collection.js:75:36
    at Array.forEach (<anonymous>)
    at Collection.forEach (~/.nvm/versions/node/v18.17.1/lib/node_modules/@ant-design/codemod-v4/node_modules/jscodeshift/src/Collection.js:74:18)

property.key有可能为undefined

图片

v3-Modal-method-with-icon-to-v4.js:98