-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(analyzer): readonly fields #4135
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
Changes from all commits
947a25b
c7c485d
38bc649
8c716d3
26004a4
b3f0929
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@lit-labs/analyzer': patch | ||
| --- | ||
|
|
||
| Supports class accessors (pairs, readonly, or setter-only) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@lit-labs/analyzer': patch | ||
| --- | ||
|
|
||
| Supports non-reactive, constructor assigned class fields |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@lit-labs/analyzer': patch | ||
| --- | ||
|
|
||
| Supports jsDoc `@readonly` tag on non-reactive class fields |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@lit-labs/analyzer': patch | ||
| --- | ||
|
|
||
| Supports typescript `readonly` keyword on non-reactive class fields |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,8 +39,25 @@ export class ElementA extends LitElement { | |
|
|
||
| [unsupportedPropertyName] = ''; | ||
|
|
||
| /** @type {number} */ | ||
| get getterOnly() { | ||
| return 0; | ||
| } | ||
|
|
||
| /** @type {number} */ | ||
| get accessorPair() { | ||
| return 0; | ||
| } | ||
| set accessorPair(_) { | ||
| void 0; | ||
| } | ||
|
|
||
| /** @readonly */ | ||
| readonlyField = 0; | ||
|
|
||
| constructor() { | ||
| super(); | ||
| this.constructorAssignOnly = 0; | ||
justinfagnani marked this conversation as resolved.
Show resolved
Hide resolved
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we make something readonly that's in the LitElement static properties block?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd still want to cover the case of a javascript file with a constructor-assigned field imo readonly is an additional layer to that |
||
| this.notDecorated = ''; | ||
| this.noOptionsString = ''; | ||
| this.noOptionsNumber = 42; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.