简体   繁体   中英

errors in app created with create-react-app --typescript

I created a new app using create-react-app with the --typescript flag. This generates the file App.tsx. When I open this file in VS Code I get lots of "problems" identified before I even change any of the generated code. The first error is on the "div" tag returned by the render method. It says "Cannot find name 'div'". Running tslint doesn't output any errors. Is there some configuration I need to do in VS Code to remove these problems?

You can try with this command with npm:

npx create-react-app --scripts-version=react-scripts-ts

npx comes with npm 5.2+ and higher, so if your npm version is below 5.2 you should update it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM