React Typescript编译失败(TS错误)



我克隆了一个项目,当我试图启动它时,我有Typescript错误。

Failed to compile.
./src/route/reset-password/reset-password-component.tsx
[tsl] ERROR in src/route/reset-password/reset-password-component.tsx(67,14)
TS2314: Generic type 'SyntheticEvent<T>' requires 1 type argument(s).

我怎样才能忽略这些错误呢?

您可以使用ts-ignore,方法是在使用SyntheticEvent的那一行添加注释。

src/route/reset-password/reset-password-component.tsx66

的例子:

// @ts-ignore
const foo: SyntheticEvent = {
...
};

我要小心使用,因为这个错误很可能是由于输入错误引起的。

最新更新