alibaba / lowcode-engine

An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系
https://lowcode-engine.cn
MIT License
14.66k stars 2.55k forks source link

Cannot read property 'symbol' of undefined #557

Open eightHundreds opened 2 years ago

eightHundreds commented 2 years ago

Describe the bug (required) / 详细描述 bug(必填)

TypeError: Cannot read property 'symbol' of undefined
    at getDocgenTypeHelper (/Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/@alilc+lowcode-material-parser@1.0.3/node_modules/@alilc/lowcode-material-parser/lib/parse/ts/index.js:204:14)
    at getFunctionReturns (/Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/@alilc+lowcode-material-parser@1.0.3/node_modules/@alilc/lowcode-material-parser/lib/parse/ts/index.js:46:22)
    at getDocgenTypeHelper (/Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/@alilc+lowcode-material-parser@1.0.3/node_modules/@alilc/lowcode-material-parser/lib/parse/ts/index.js:304:26)
    at MyParser.getDocgenType (/Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/@alilc+lowcode-material-parser@1.0.3/node_modules/@alilc/lowcode-material-parser/lib/parse/ts/index.js:360:24)
    at /Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/react-docgen-typescript@1.22.0_typescript@4.7.2/node_modules/react-docgen-typescript/lib/parser.js:429:25
    at Array.forEach (<anonymous>)
    at MyParser.Parser.getPropsInfo (/Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/react-docgen-typescript@1.22.0_typescript@4.7.2/node_modules/react-docgen-typescript/lib/parser.js:402:27)
    at MyParser.Parser.getComponentInfo (/Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/react-docgen-typescript@1.22.0_typescript@4.7.2/node_modules/react-docgen-typescript/lib/parser.js:187:30)
    at /Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/@alilc+lowcode-material-parser@1.0.3/node_modules/@alilc/lowcode-material-parser/lib/parse/ts/index.js:474:27
    at Array.reduce (<anonymous>)

https://github.com/alibaba/lowcode-engine/blob/fb580b5fb2653aec27e2213425e2865719002542/modules/material-parser/src/parse/ts/index.ts#L346-L348

checker.typeToTypeNode返回的类型是TypeNode.

https://github.com/alibaba/lowcode-engine/blob/fb580b5fb2653aec27e2213425e2865719002542/modules/material-parser/src/parse/ts/index.ts#L51-L59

55行, TypeNode是没有type字段的(官方的类型里没找到type字段, 但部分case运行时有发现存在),所以会传入undefined,再接着运行就会出问题

A clear and concise description of what the bug is. / 请提供清晰且精确的 bug 描述


To Reproduce (required) / 如何复现 bug?(必填,非常重要)

Steps to reproduce the behavior: / 详细复现步骤:


import React from 'react';
import 'react-dom';
interface Props {
  onKeyPress: JSX.IntrinsicElements['input']['onKeyPress'];
}
const Input = (p: Props) => {
  return (
    <div>
      <input />
    </div>
  );
};

export { Input };

把这个当做组件库入口, 用@alifd/build-plugin-lowcode跑meta生成

Expected behavior (required) / 预期行为(必填,非常重要)

A clear and concise description of what did you expect to happen. / 请清晰和精确的描述你预期的行为


Screenshots (optional) / bug 截图(可选)

Sceenshots for further information. (If applicable.) / 一些有用的截图将会帮助我们更好的明确以及定位问题


Environments (please complete the following information) (required): / 请提供如下信息(必填)

(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)

Additional context (optional) / 更多额外信息(可选)

Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题

LeoYuan commented 2 years ago

@akirakai 麻烦帮忙鉴定下是 bug 还是不支持这种写法~

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 2 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been stalled for 10 days with no activity.

eightHundreds commented 2 years ago

@LeoYuan 这个机器人太蠢了, 明明是没人跟进, 就自动关闭. 这样做是逃避问题

LeoYuan commented 2 years ago

这个我帮你重新打开一下~

机器人还不完善,本质上还是对没有符合被打上应该继续跟进的label自动管理,不过这种一直没人看的没覆盖到😭

LeoYuan commented 2 years ago

@akirakai 帮忙鉴定下?

akirakai commented 2 years ago

我试着重现下