chore: improve TS definition syntax #26
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
试图解决:ant-design/ant-design#51171
问题过程:
发现 antd 的构建产物是有问题的:ref: https://npmmirror.com/package/antd/files/es/theme/util/genStyleUtils.d.ts?version=5.21.3#L6
追踪构建产物,发现是 cssinjs-utils 的构建产物长这样:https://npmmirror.com/package/@ant-design/cssinjs-utils/files/es/util/genStyleUtils.d.ts?version=1.1.0#L67-L68
上面这个 cssinjs-utils 的构建产物很奇怪,不缺定是不是 tsc 的问题还是 father 构建的问题。 @PeachScript 大佬有空可以帮忙看看,
解决方案
改用
Partial<Record<>>
代替{ [key in xxx]: xxx }
. 方案。最后 cssinjs-utils 的构建产物长这样:
能解决 antd 侧构建出来的内容缺少类型定义