oscaroox/objection-visibility

Using accessors in typescript

Opened this issue · 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.

The following code might work:

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

The following code might work:

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

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

Did you manage to solve this issue?