修改tsconfig.js 增加"noImplicitAny": false,解决代码类型没有指定,显示Any 错误
To solve the error, explicitly set the parameter's type to any
, use a more specific type or set noImplicitAny
to false
in tsconfig.json
.
https://bobbyhadz.com/blog/typescript-parameter-implicitly-has-an-any-type#:~:text=The%20%22Parameter%20%27X%27%20implicitly%20has%20an%20%27any%27%20type%22,type%20or%20set%20noImplicitAny%20to%20false%20in%20tsconfig.json.
2.This syntax requires an imported helper but module 'tslib' cannot be found
https://bobbyhadz.com/blog/typescript-syntax-requires-imported-helper-but-module-tslib-cannot#:~:text=To%20solve%20the%20error%20%22This%20syntax%20requires%20an,IDE%20is%20using%20the%20correct%20%28workspace%29%20TypeScript%20version.
3. 错误信息:
解决: 降@swc/core 版本
4. Cannot use jsx unless the '--jsx' flag is provided (React)
.....but '--jsx' is not set
原因: vscode 的typescript 版本与项目的版本不匹配
To solve the error "Cannot use jsx unless the '--jsx' flag is provided", restart your IDE and development server and make sure your IDE is using the same version of TypeScript that your project uses.
The project's TypeScript version and your IDE's TypeScript versions should match.
5.setState does not exist on type ....
解决方法:
6.
ReactNode' is not assignable to type 'React.ReactNode'.
7.[LiveReloadPlugin] Live Reload disabled: listen EADDRINUSE: address already in use :::35729
重新运行: