Refactor: mark query and handler properties as readonly#1307
Refactor: mark query and handler properties as readonly#1307iOvergaard merged 5 commits intomainfrom
Conversation
These Lit decorator properties create getters and are never directly assigned, so they should be marked readonly for correctness. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These properties are initialized with arrow functions and never reassigned, so they should be marked readonly for correctness. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net |
There was a problem hiding this comment.
Pull request overview
This PR is a mechanical TypeScript refactor across Lit-based components to express immutability by marking @query/@queryAll/@queryAssignedElements decorated properties and arrow-function handler properties as readonly.
Changes:
- Mark decorated query properties as
readonlyacross components. - Mark arrow-function handler properties as
readonlywhere they are intended to be stable references.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/toast-notification/toast-notification.element.ts | Marks @query element reference as readonly. |
| src/components/toast-notification-container/toast-notification-container.element.ts | Marks internal slot/close handlers as readonly. |
| src/components/textarea/textarea.element.ts | Marks textarea @query reference as readonly. |
| src/components/tabs/tab-group.element.ts | Marks queried elements and assigned elements array as readonly. |
| src/components/table/table-row.element.ts | Marks assigned slot cell nodes as readonly. |
| src/components/slider/slider.element.ts | Marks queried elements and resize handler as readonly. |
| src/components/select/select.element.ts | Marks native select @query reference as readonly. |
| src/components/responsive-container/responsive-container.element.ts | Marks queried elements and assigned elements array as readonly. |
| src/components/ref-node/ref-node.element.ts | Marks queried element reference as readonly. |
| src/components/range-slider/range-slider.element.ts | Marks multiple queried element references as readonly. |
| src/components/radio/radio.element.ts | Marks input @query reference as readonly. |
| src/components/pagination/pagination.element.ts | Marks queried button list and pages group as readonly. |
| src/components/modal/modal.element.ts | Marks dialog @query reference as readonly. |
| src/components/input/input.element.ts | Marks input @query reference as readonly. |
| src/components/input-file/input-file.element.ts | Marks queried dropzone references as readonly. |
| src/components/icon-registry/UUIIconRegistry.ts | Marks icon request handler property as readonly. |
| src/components/file-dropzone/file-dropzone.element.ts | Marks queried input/dropzone references as readonly. |
| src/components/combobox/combobox.element.ts | Marks queried combobox elements/assigned list as readonly. |
| src/components/combobox/combobox-async-options-example.ts | Marks async fetch handler as readonly. |
| src/components/combobox/combobox-async-example.ts | Marks async fetch/search handlers as readonly. |
| src/components/combobox-list/combobox-list.element.ts | Marks assigned option collections as readonly. |
| src/components/color-picker/color-picker.element.ts | Marks queried input/preview/swatches as readonly. |
| src/components/button/button.element.ts | Marks button @query reference as readonly. |
| src/components/breadcrumbs/breadcrumbs.element.ts | Marks assigned breadcrumb nodes collection as readonly. |
| src/components/boolean-input/boolean-input.element.ts | Marks input @query reference as readonly. |
Comments suppressed due to low confidence (1)
src/components/toast-notification-container/toast-notification-container.element.ts:82
- PR description says arrow-function handler properties are being marked
readonly, but in this filepauseAutoClose/resumeAutoCloseare still mutable arrow properties. Either mark those asreadonlyas well (if they’re intended to be stable handler references) or adjust the PR description/scope so it’s clear which handlers are covered.
private readonly onToastClosed = (e: UUIToastNotificationEvent) => {
this.removeToast(e.target);
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1307.westeurope.azurestaticapps.net |



Summary
@query,@queryAll, and@queryAssignedElementsdecorated properties asreadonly— these are getter-based and never directly assignedreadonly— these are initialized once and never reassignedTest plan
npm run test)🤖 Generated with Claude Code