lowcode-engine icon indicating copy to clipboard operation
lowcode-engine copied to clipboard

Cannot read property 'symbol' of undefined

Open eightHundreds opened this issue 3 years ago • 7 comments

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/@[email protected]/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/@[email protected]/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/@[email protected]/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/@[email protected]/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/[email protected][email protected]/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/[email protected][email protected]/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/[email protected][email protected]/node_modules/react-docgen-typescript/lib/parser.js:187:30)
    at /Users/xxx/Code/low-code/low-code-engine/node_modules/.pnpm/@[email protected]/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): / 请提供如下信息(必填)

  • AliLowCodeEngine version: [e.g. 1.0.0] / 低代码引擎版本
  • AliLowCodeEngineExt version: [e.g. 1.0.0] / 低代码引擎扩展包版本
  • Browser [e.g. chrome, safari] / 浏览器版本
  • materials / plugins / tools / 其他物料 / 插件 / 工具链版本

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

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

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

eightHundreds avatar May 26 '22 12:05 eightHundreds

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

LeoYuan avatar May 31 '22 03:05 LeoYuan

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] avatar Jun 11 '22 02:06 github-actions[bot]

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

github-actions[bot] avatar Jun 14 '22 02:06 github-actions[bot]

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

eightHundreds avatar Jun 27 '22 06:06 eightHundreds

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

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

LeoYuan avatar Jun 27 '22 06:06 LeoYuan

@akirakai 帮忙鉴定下?

LeoYuan avatar Jun 27 '22 06:06 LeoYuan

我试着重现下

akirakai avatar Jun 27 '22 07:06 akirakai