This is because VSCode’s Typescript version is not using the newest babel features that create-react-app uses by default.
You can change VS Code to use the workspace’s version of Typescript instead, which will fix this issue.
Open a TypeScript or JavaScript file and click on the TypeScript version number in the Status Bar. A message box will appear asking you which version of TypeScript VS Code should use
Select “Use Workspace Version” to use the newer Create React App typescript version.