Skip to content

Commit c9aab5a

Browse files
committed
fix: remove unnecessary type assertions for host in button and select components
1 parent 740b72d commit c9aab5a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

packages/components/src/components/button/component.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ import { SpanFC } from '../../internal/functional-components/span/component';
5555
import type { AriaHasPopupPropType } from '../../schema/props/aria-has-popup';
5656
import { validateAccessAndShortKey } from '../../schema/validators/access-and-short-key';
5757
import clsx from '../../utils/clsx';
58-
import { dispatchDomEvent, KolEvent } from '../../utils/events';
5958
import { setFocus } from '../../utils/element-focus';
59+
import { dispatchDomEvent, KolEvent } from '../../utils/events';
6060
import { propagateResetEventToForm, propagateSubmitEventToForm } from '../form/controller';
6161
import { AssociatedInputController } from '../input-adapter-leanup/associated.controller';
6262

@@ -121,14 +121,14 @@ export class KolButtonWc implements ButtonAPI {
121121
}
122122

123123
if (this.host) {
124-
dispatchDomEvent(this.host as HTMLElement, KolEvent.click, this.state._value);
124+
dispatchDomEvent(this.host, KolEvent.click, this.state._value);
125125
}
126126
};
127127

128128
private readonly onMouseDown = (event: MouseEvent) => {
129129
this.state?._on?.onMouseDown?.(event);
130130
if (this.host) {
131-
dispatchDomEvent(this.host as HTMLElement, KolEvent.mousedown);
131+
dispatchDomEvent(this.host, KolEvent.mousedown);
132132
}
133133
};
134134

@@ -323,7 +323,7 @@ export class KolButtonWc implements ButtonAPI {
323323
};
324324

325325
public constructor() {
326-
this.controller = new AssociatedInputController(this, 'button', this.host as HTMLElement);
326+
this.controller = new AssociatedInputController(this, 'button', this.host);
327327
}
328328

329329
@Watch('_accessKey')

packages/components/src/components/input-adapter-leanup/associated.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class AssociatedInputController implements Watches {
9393
while (host?.shadowRoot === null && host !== document.body) {
9494
host = host?.parentNode as HTMLElement;
9595
if ((host as unknown as ShadowRoot).host) {
96-
host = (host as unknown as ShadowRoot).host as HTMLElement;
96+
host = (host as unknown as ShadowRoot).host;
9797
}
9898
}
9999
return host;

packages/components/src/components/select/component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export class KolSelectWc implements SelectAPI {
244244
@State() private inputHasFocus = false;
245245

246246
public constructor() {
247-
this.controller = new SelectController(this, 'select', this.host as HTMLElement);
247+
this.controller = new SelectController(this, 'select', this.host);
248248
}
249249

250250
private showAsAlert(): boolean {

0 commit comments

Comments
 (0)