[TypeScript] Keep prompting: Unable to redeclare block scope variables

[TypeScript] Keep prompting: Unable to redeclare block scope variables

Problem description: When writing ts code in VSCode, after writing and saving, through tsc file name.ts compilation, you will see a red wavy line under the variable name, indicating that block scope variables cannot be redeclared.

Insert image description here

Solution: Just use tsc --init to generate the tsconfig.json file in the terminal and the problem will be solved. Or create a new tsconfig.json file in the current folder, and the error message will disappear (an empty tsconfig will also work)

Insert image description here

Guess you like

Origin blog.csdn.net/m0_46374969/article/details/132685584