【发布时间】:2021-06-09 09:00:30
【问题描述】:
在我的带有 TypeScript 的 Next.JS 项目中,我无法运行构建,因为我有 Type error: '_' is declared but its value is never read.
我尝试在我的 tsconfig 中将“noUnusedLocals”设置为 false,但我在构建中保留了相同的错误
useScrollPosition(
({ _, currPos }: any) => {
const isShow = currPos.y > -100
if (isShow !== hideOnScroll) setHideOnScroll(isShow)
},
[hideOnScroll],
null,
false,
null
)
【问题讨论】:
-
你为什么要在那里使用
_?如果只需要从参数中解构currPos,就做{ currPos }。
标签: reactjs typescript next.js