Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using accessors in typescript #11

Open
simoami opened this issue Jan 19, 2020 · 3 comments
Open

Using accessors in typescript #11

simoami opened this issue Jan 19, 2020 · 3 comments

Comments

@simoami
Copy link

simoami commented Jan 19, 2020

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 simoami changed the title Helli, Using accessors in typescript Jan 19, 2020
@oscaroox
Copy link
Owner

The following code might work:

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

@simoami
Copy link
Author

simoami commented Jan 19, 2020

The following code might work:

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

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

@oscaroox
Copy link
Owner

oscaroox commented Feb 8, 2020

Did you manage to solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants