Why did I get the error cannot redeclare block-scoped variable 'name' in TypeScript?

Viewed 7681

I am trying to declare new variable called name in my typescript code. I have only one line of code.

var name:string = "John";

But got error

PS D:\TypeScript> tsc test.ts
C:/Users/Users/AppData/Roaming/npm/node_modules/typescript/lib/lib.d.ts(18568,15): error TS2451: Cannot re
declare block-scoped variable 'name'.
test.ts(1,5): error TS2451: Cannot redeclare block-scoped variable 'name'.

What is the reason behind this error?

cannot redeclare block-scoped variable 'name'

cannot redeclare block-scoped variable 'name'

2 Answers
Related