Skip to content

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

在vue中使用tsx时,会报错:JSX 元素隐式具有类型 “any“,因为不存在接口 “JSX.IntrinsicElements“

解决方法:

env.d.ts中添加以下代码:

ts
declare global {
  namespace JSX {
    interface IntrinsicElements {
      [elem: string]: any;
    }
  }
}

Released under the MIT License.