英文:
NPM is throwing Type expected while build react/nextjs project after adding use-places-autocomplete
问题
我在构建我的React/Next.js项目时遇到了这个错误。
我尝试以管理员身份打开VS Code,但仍然面临此问题。
./node_modules/use-places-autocomplete/dist/index.d.ts:21:24
类型错误:期望类型。
19 | export type Suggestion = google.maps.places.AutocompletePrediction;
20 |
> 21 | export type Status = `${google.maps.places.PlacesServiceStatus}` | "";
| ^
Windows 10机器
Node版本14.17.5
Package.json
react 17.0.2
typescript ^3.7.2
将ts升级到4.1.0会导致此错误 -> `E/launcher - Error: TSError: ⨯ Unable to compile TypeScript`
英文:
I am getting this error upon building my react/nextjs project.
I have tried to open vs code as an administrator but still facing this issue.
./node_modules/use-places-autocomplete/dist/index.d.ts:21:24
Type error: Type expected.
19 | export type Suggestion = google.maps.places.AutocompletePrediction;
20 |
> 21 | export type Status = `${google.maps.places.PlacesServiceStatus}` | "";
| ^
Windows 10 machine
Node version 14.17.5
Package.json
react 17.0.2
typescript ^3.7.2
Upgarding ts to 4.1.0 gives this error -> E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
答案1
得分: 0
问题出在TS版本上。我升级到4.3.2版本,问题得以解决!
英文:
Issue was with TS version. I upgraded to 4.3.2 and it worked!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论