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

this should be able to use in static property initializer #38756

Closed
LongTengDao opened this issue May 24, 2020 · 2 comments
Closed

this should be able to use in static property initializer #38756

LongTengDao opened this issue May 24, 2020 · 2 comments

Comments

@LongTengDao
Copy link
Contributor

LongTengDao commented May 24, 2020

TypeScript Version: 3.9.3

Search Terms:

Code

class C { static default = /*#__PURE__*/decorator(this); }

Expected behavior:

No error, because this in static property refer to the class self according to spec.

Actual behavior:

TS2334: 'this' cannot be referenced in a static property initializer.

Playground Link:

Related Issues:

@MartinJohns
Copy link
Contributor

Duplicate of #36267. Search terms: this static class

@LongTengDao
Copy link
Contributor Author

Sorry, I only found #6331 by TS2334. Thank you.

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