Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2018-08-24 #2

Open
ibcLee opened this issue Aug 24, 2018 · 0 comments
Open

2018-08-24 #2

ibcLee opened this issue Aug 24, 2018 · 0 comments

Comments

@ibcLee
Copy link
Owner

ibcLee commented Aug 24, 2018

  1. 调研typescript,基于老项目向typescript迁移, 参考:
    ProtoTeam
    Migrating from JavaScript
    TypeScript-React-Conversion-Guide

  2. 遇到问题,配置后打包报错,升级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

  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版本之前的行为模式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant