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
遇到问题,配置后打包报错,升级webpack4应该可以解决,但是webpack4不向下兼容,尝试安装旧版本awesome-script-loader解决了 ERROR in ./src/base/index.js Module build failed: Error: It looks like you're using an old webpack version without hooks support. If you're using awesome-script-loader with React storybooks consider upgrading @storybook/react to at least version 4.0.0-alpha.3
之后又遇到antd的报错 ERROR in [at-loader] ./node_modules/antd/lib/form/Form.d.t Type 'keyof T' does not satisfy the constraint 'string'.
通过在tsconfig.js增加 "keyofStringsOnly": true 配置,
原因是TypeScript 2.9中添加的另外一项重要特性是在keyof和映射对象类型(mapped object type)中使用符号(symbol)和数字字面量。keyof操作符要比TypeScript推断唯一符号类型这一特性更早,因此keyof一直不能识别符号化的key。TypeScript 2.9改变了keyof的行为,能够识别唯一符号和数字字面量类型。因为这是一个破坏性的变更,所以可以通过--keyofStringsOnly标记切换回TypeScript 2.9版本之前的行为模式。
The text was updated successfully, but these errors were encountered:
调研typescript,基于老项目向typescript迁移, 参考:
ProtoTeam
Migrating from JavaScript
TypeScript-React-Conversion-Guide
遇到问题,配置后打包报错,升级webpack4应该可以解决,但是webpack4不向下兼容,尝试安装旧版本awesome-script-loader解决了
ERROR in ./src/base/index.js Module build failed: Error: It looks like you're using an old webpack version without hooks support. If you're using awesome-script-loader with React storybooks consider upgrading @storybook/react to at least version 4.0.0-alpha.3
之后又遇到antd的报错
ERROR in [at-loader] ./node_modules/antd/lib/form/Form.d.t Type 'keyof T' does not satisfy the constraint 'string'.
通过在tsconfig.js增加
"keyofStringsOnly": true
配置,原因是TypeScript 2.9中添加的另外一项重要特性是在keyof和映射对象类型(mapped object type)中使用符号(symbol)和数字字面量。keyof操作符要比TypeScript推断唯一符号类型这一特性更早,因此keyof一直不能识别符号化的key。TypeScript 2.9改变了keyof的行为,能够识别唯一符号和数字字面量类型。因为这是一个破坏性的变更,所以可以通过--keyofStringsOnly标记切换回TypeScript 2.9版本之前的行为模式。
The text was updated successfully, but these errors were encountered: