umi中TS报错:TS7026: JSX element implicitly has type ‘any’…
文章目录
报错信息:TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
报错原因:在使用typescript的时候,在vue或react、node中报以上错误,是JSX 元素隐式具有类型 "any",因为不存在全局类型 "JSX.Element"。
解决方法:
第一种:
不使用严格的类型检查,即在 tsconfig.json 中设置 "strict": false
在 tsconfig.json中设置 "noImplicitThis": false
"noImplicitAny": false, // 是否在表达式和声明上有隐含的any类型时报错
第二种:
{
"compilerOptions": {
"noImplicitAny": false, // 是否在表达式和声明上有隐含的any类型时报错
}
}tsconfig.json 的配置选项可查看官方文档
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论