Issue
I'm just learning typescript and following an online course. I've hit a bit of a snag immediately and must be a vscode setting or something?
When I compile app.ts it generates the app.js but immediately I get a typescript error because the person variable is conflicting with the person variable in the app.js which was just generated. The error is "Cannot redeclare block-scoped variable".
Can someone tell me how to avoid this?
Solution
Resolved in the comments:
In absence of a tsconfig.json file, TypeScript (built into Visual Studio Code) treated your JS output directory as an input directory. The problem was solved by creating the file; if the file existed, it would require configuring TypeScript not to treat its output as additional input via includes, excludes, or files configurations (or by setting an outFile or outDir).
Answered By - Jeff Bowman


0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.