这是代码行:
const handleChangeProduct = (e: JSX.TargetedEvent<HTMLSelectElement, Event>) => {
const val = e.currentTarget.value;
setDbEditProduct(val);
};
获取此错误:
Namespace 'global.JSX' has no exported member 'TargetedEvent'
这是我的进口产品:
import { h, FunctionalComponent, Fragment } from 'preact';
import { useState } from 'preact/hooks';
import NativeSelect from '@material-ui/core/NativeSelect';
这是我的TSConfig:
{
"compilerOptions": {
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"lib": ["es2019", "DOM", "ES6", "DOM.Iterable", "ScriptHost"],
"strict": true,
"alwaysStrict": true,
"removeComments": false,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"noUnusedLocals": true,
"jsx": "react",
"jsxFactory": "h",
"skipLibCheck": true,
"suppressImplicitAnyIndexErrors": true,
"types": ["node"]
},
"include": ["./css.d.ts", "./global.d.ts", "./frontend/**/*"]
}
这个错误有点帮助。。。修复方法如下:
import { h, FunctionalComponent, JSX, Fragment } from 'preact';
(将JSX添加到导入中(