小编ita*_*ied的帖子

Typescript 推断类型无法在没有引用的情况下命名

我的项目的设置是tsdx(基于RollupTypescript)。
在我的 IDE (vscode) 中工作一切看起来都很好,甚至运行也yarn tsc没有错误。

当我运行时yarn build(即tsdx build),我收到以下错误:

(typescript) Error: /home/me/dev/app/src/components/alert/Alert.tsx(36,7): semantic error TS2742: The inferred type of 'AlertContainer' cannot be named without a reference to '@emotion/serialize/node_modules/csstype'. This is likely not portable. A type annotation is necessary.
Error: /home/me/dev/app/src/components/alert/Alert.tsx(36,7): semantic error TS2742: The inferred type of 'AlertContainer' cannot be named without a reference to '@emotion/serialize/node_modules/csstype'. This is likely not portable. A type annotation is necessary.
Run Code Online (Sandbox Code Playgroud)

错误中引用的代码是:

(typescript) …
Run Code Online (Sandbox Code Playgroud)

rollup typescript reactjs tsdx

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

reactjs ×1

rollup ×1

tsdx ×1

typescript ×1