-
Notifications
You must be signed in to change notification settings - Fork 276
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
Father build类型生成问题 #713
Comments
第二种才是正确写法,第一种直接跑 tsc 应该也会失败的 |
@umijs/max 构建也正常的 |
@liangskyli 要用第一种声明方式的话,tsconfig.json 里的 jsx 配置需要改成
如果你试下来仍然不行,可以提供最小可复现仓库看看 |
@PeachScript : tsconfig.json 的 jsx 是react-jsx,复现demo: https://github.com/liangskyli/dumi-lerna-demo/tree/farther-4.3.4-bug |
father": "4.3.1", 这个包就没问题 |
复现仓库可以复现,但和 tsc 行为不一致的原因尚未查明,哪怕按照 TypeScript 官方指南创建一个最简 compiler 也会报错:https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler |
原因已找到,下个版本修复,详见 #716 另外回到复现项目本身,monorepo 下建议子包都各自放独立的 tsconfig.json,可以继承根目录的内容但 include 需要仅包含子包文件,这会使得子包构建时 tsc include 的文件数量大幅减少、提升构建效率,同时也可以避免在现有 father 版本中出现该问题 |
好,demo里子包没加独立的 tsconfig.json,正式的库会加,多谢建议 |
v4.3.5 已发布 |
there's still some error occurs when typescript > 5.4:
npx tsc -w --noEmit
try code below: export type TypedJsonValue =
| { type: "null"; value: null }
| { type: "array"; value: number[] };
for (const [{ type, value }] of [] as [TypedJsonValue][])
if (type === "array") value.forEach(() => {}); |
版本 :
[email protected]
[email protected]
[email protected]
编译代码
出现编译错误
编译代码改为FC类型,这样就编译正常
期待:这两个写法应该都能正常编译成功。
The text was updated successfully, but these errors were encountered: