37
TypeScript Error 2304: Cannot find name 'div' - CRA TS Template
source link: https://segmentfault.com/a/1190000041473578
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
TypeScript Error 2304: Cannot find name 'div' - CRA TS Template
发布于 51 分钟前
使用 react 官方文档上的命令 npx create-react-app my-app --template typescript
创建个一个 ts 项目,打开后发现 index.tsx
和 App.tsx
文件有报错。原来是 vscode workspace 中的 ts 版本 和 项目中的 ts 版本不一致所致。
"react": "^17.0.2", "typescript": "^4.5.5",
vscode -> 设置 -> 工作区,打开 setting.json, 添加:
{ "typescript.tsdk": "./node_modules/typescript/lib" }
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK