fix(ts_web): resolve TypeScript nullability and event typing issues across web components

This commit is contained in:
2026-04-01 05:00:21 +00:00
parent b1c8a7446e
commit af1f660486
78 changed files with 429 additions and 399 deletions

View File

@@ -288,8 +288,8 @@ export const demoFunc = () => html`
}
if (dataBtn && output) {
dataBtn.addEventListener('clicked', (e: CustomEvent) => {
output.textContent = `Clicked: Secondary button with data: ${e.detail.data}`;
dataBtn.addEventListener('clicked', (e: Event) => {
output.textContent = `Clicked: Secondary button with data: ${(e as CustomEvent).detail.data}`;
});
}
@@ -322,9 +322,9 @@ export const demoFunc = () => html`
const output = elementArg.querySelector('#form-output');
if (form && output) {
form.addEventListener('formData', (e: CustomEvent) => {
output.innerHTML = '<strong>Form submitted with data:</strong><br>' +
JSON.stringify(e.detail.data, null, 2);
form.addEventListener('formData', (e: Event) => {
output.innerHTML = '<strong>Form submitted with data:</strong><br>' +
JSON.stringify((e as CustomEvent).detail.data, null, 2);
});
}

View File

@@ -31,10 +31,10 @@ export class DeesButton extends DeesElement {
return true;
}
})
accessor text: string;
accessor text!: string;
@property()
accessor eventDetailData: string;
accessor eventDetailData!: string;
@property({
type: Boolean,
@@ -69,7 +69,7 @@ export class DeesButton extends DeesElement {
accessor insideForm: boolean = false;
@property({ type: String, reflect: true })
accessor icon: string;
accessor icon!: string;
@property({ type: String, reflect: true })
accessor iconPosition: 'left' | 'right' = 'left';