UNPKG

@alicloud/console-components

Version:

Alibaba Cloud React Components

58 lines (50 loc) 3.19 kB
export default { // 通用 'title:types_amended': '修正的类型', 'title:fixed_{prop}!html': '<span role="img">🪲</span> 修正 <code>props.{prop}</code> 类型错误', 'title:test_cases': '测试用例', 'title:issues_empty': '类型没问题,无修正', 'title:issues_not_written': '类型有问题,尚未记录', 'op:use_fusion_component': '使用 @alifd/next(应看起来没有任何变化)', 'issue:col:code': '问题代码', 'issue:col:type': '问题归类', 'issue:col:errors': '运行错误', 'issue:col:consequences': '可能后果', 'issue:type_false_report': '类型误报', 'issue:type_unprotected': '类型无保护', 'issue:type_mismatch': '不切实际', 'issue:runtime_warning': '运行告警', 'issue:runtime_crash': '运行崩溃', 'issue_consequence:build_fail': '构建失败', 'issue_consequence:confusing': '类型靠文档或猜测', 'issue_consequence:runtime_uncaught': '未捕获异常', 'issue_consequence:runtime_prop_types': 'PropTypes 报错', 'issue_consequence:debug_warning': '错误警告', 'issue_consequence:runtime_crash': '程序崩溃', 'issue_consequence:abnormal': '程序运行不正常,且很难溯源', 'message:issues_empty': '组件类型没问题,无修复或增强。', 'message:issues_not_written': 'TODO:稍后记录成表格', // affix 'affix:message:summary_on_prop_container!html!lines': `原类型:<code>container?: () => React.ReactElement&lt;any&gt;;</code> 导致 ref 非常难用。 1. <code>ref</code> 容易报错,因为其默认值不可能就是 <code>ReactElement</code> 2. <code>container()</code> 容易报错,因为内置组件 ref 得到的类型是 HTMLElement 3. 即使把 <code>container()</code> 的返回强行指定成 <code>ReactComponent</code> 也会出现运行时报错 我们需要兼容实现中可用的类型 总之,原 <code>container</code> 的定义完全错误`, // animation 'animation:message:summary_on_prop_children!html!lines': `原类型:<code>children?: React.ReactElement&lt;any&gt; | Array&lt;any&gt;;</code>。 1. 凡是 <code>any</code> 都需要有充分的理由,没有则必须纠正为可预期的类型 2. 官方类型定义使运行时错误无法预判而可能导致问题代码上线`, 'animation:message:summary_on_prop_animation!html!lines': `原类型:<code>animation?: string | any;</code>。 1. 凡是可以明确的类型用 <code>any</code> 的,就是罪 2. 凡是任何类型 + <code>| any</code> 的,就是罪加一等,因为 <code>无论什么 | any === any</code>(基础知识) 我们需将`, 'animation:message:fix_prop_animation!html!lines': `原类型:<code>animation?: string | any;</code> 问题: 1. 凡是可以明确的类型用 <code>any</code> 的,就是罪 2. 任何东西只要 <code>| any</code> 的就等价于 <code>any</code>,只能说原作者基础知识不扎实`, 'animation:message:fix_prop_callbacks!html!lines': `原类型:<code>所有的回调?: (node: React.ReactElement&lt;any&gt;) => void;</code> 问题: 1. 实操得到的值都是 DOM 元素 2. 原作者对 ReactElement 和 HTMLElement 概念不清晰` };