JSX 元素隐式具有类型 “any“,因为不存在接口 “JSX.IntrinsicElements“

3,379 阅读1分钟

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicEle 翻译过来就是JSX 元素隐式具有类型 “any“,因为不存在接口 “JSX.IntrinsicElements“

解决的办法有二种:

  1. 不使用严格的类型检查,即在 tsconfig.json 中设置 “strict”: false
{
  "compilerOptions": {
    "strict": false
  }
}
  1. 在 tsconfig.json中设置 “noImplicitThis”: false
{
  "compilerOptions": {
    "noImplicitAny": false, // 是否在表达式和声明上有隐含的any类型时报错
  }
}