Daniel Flores
Daniel Flores

Reputation: 770

get Symbol description in TypeScript

Is there a way to get a Symbol description in TypeScript just like it's done with JavaScript?

Example,

const x = Symbol('x');
console.log(x.description) // returns 'x' in Javascript but error in TypeScript.

Upvotes: 1

Views: 70

Answers (1)

Shlang
Shlang

Reputation: 3230

It is ES2019 feature, so you need to add "lib": ["es2019"] to compilerOptions section of your tsconfig.json.

Upvotes: 2

Related Questions