Abdulmoiz Ahmer
Abdulmoiz Ahmer

Reputation: 2351

'Symbol' only refers to a type, but is being used as a value here

I am new to typescript and i cant understand what i am doing wrong in here. I read it from the official documentation of typescript. The link is below. https://www.typescriptlang.org/docs/handbook/symbols.html The typescript version i have installed is 3.5.2

let sym1 = Symbol();

Upvotes: 1

Views: 3754

Answers (1)

Abdulmoiz Ahmer
Abdulmoiz Ahmer

Reputation: 2351

Since Symbols is a feature that was introduced in ecmascript6. It's not working in es5 so i changed the target from "target": "es5" to "target": "es6" to make it work in tsconfig.json file

Upvotes: 4

Related Questions