objection-visibility icon indicating copy to clipboard operation
objection-visibility copied to clipboard

Using accessors in typescript

Open simoami opened this issue 5 years ago • 3 comments

Hello, regarding the choice of use accessors.

 static get visible () {
   return ['description', 'title']
 }

results in the following error:

Accessors are only available when targeting ECMAScript 5 and higher.ts(1056)

This can be resolved by targeting es5 in tsconfig.json. However VS code still shows the error and I'm wondering if its better to provide an alternative syntax to avoid targeting the older ES standard.

simoami avatar Jan 19 '20 17:01 simoami

The following code might work:

static visible = ["description", "title"]

oscaroox avatar Jan 19 '20 19:01 oscaroox

The following code might work:

static visible = ["description", "title"]

I like it! will check if accessing this.visible on a static prop works.

simoami avatar Jan 19 '20 19:01 simoami

Did you manage to solve this issue?

oscaroox avatar Feb 08 '20 00:02 oscaroox