Skip to content

Commit 8f90b60

Browse files
authored
refactor: align type definitions for all mixins (#2971)
1 parent 025f601 commit 8f90b60

55 files changed

Lines changed: 219 additions & 330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/checkbox/test/typings/checkbox.types.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js
66
import { CheckedMixinClass } from '@vaadin/field-base/src/checked-mixin.js';
77
import { DelegateFocusMixinClass } from '@vaadin/field-base/src/delegate-focus-mixin.js';
88
import { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
9-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9+
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
1010
import '../../vaadin-checkbox.js';
1111
import { CheckboxCheckedChangedEvent, CheckboxIndeterminateChangedEvent } from '../../vaadin-checkbox.js';
1212

@@ -32,7 +32,7 @@ assertType<KeyboardMixinClass>(checkbox);
3232
assertType<CheckedMixinClass>(checkbox);
3333
assertType<DelegateFocusMixinClass>(checkbox);
3434
assertType<LabelMixinClass>(checkbox);
35-
assertType<ThemableMixin>(checkbox);
35+
assertType<ThemableMixinClass>(checkbox);
3636

3737
// Events
3838
checkbox.addEventListener('checked-changed', (event) => {

‎packages/combo-box/src/vaadin-combo-box-light.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2021 Vaadin Ltd.
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
6-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
6+
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
77
import { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
88
import { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
99
import { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';
@@ -127,7 +127,7 @@ declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
127127
interface ComboBoxLight<TItem = ComboBoxDefaultItem>
128128
extends ComboBoxDataProviderMixinClass<TItem>,
129129
ComboBoxMixinClass<TItem>,
130-
ThemableMixin {}
130+
ThemableMixinClass {}
131131

132132
declare global {
133133
interface HTMLElementTagNameMap {

‎packages/combo-box/src/vaadin-combo-box.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
77
import { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
88
import { PatternMixinClass } from '@vaadin/field-base/src/pattern-mixin.js';
9-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9+
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
1010
import { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
1111
import { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
1212
import { ComboBoxDefaultItem } from './vaadin-combo-box-mixin.js';
@@ -224,7 +224,7 @@ interface ComboBox<TItem = ComboBoxDefaultItem>
224224
ComboBoxMixinClass<TItem>,
225225
PatternMixinClass,
226226
InputControlMixinClass,
227-
ThemableMixin,
227+
ThemableMixinClass,
228228
ElementMixinClass {}
229229

230230
declare global {

‎packages/combo-box/test/typings/combo-box.types.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
2-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin';
2+
import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin';
33
import { ComboBoxDataProviderMixinClass } from '../../src/vaadin-combo-box-data-provider-mixin';
44
import { ComboBoxMixinClass } from '../../src/vaadin-combo-box-mixin';
55
import {
@@ -35,7 +35,7 @@ assertType<ComboBox>(narrowedComboBox);
3535
assertType<ElementMixinClass>(narrowedComboBox);
3636
assertType<ComboBoxDataProviderMixinClass<TestComboBoxItem>>(narrowedComboBox);
3737
assertType<ComboBoxMixinClass<TestComboBoxItem>>(narrowedComboBox);
38-
assertType<ThemableMixin>(narrowedComboBox);
38+
assertType<ThemableMixinClass>(narrowedComboBox);
3939

4040
narrowedComboBox.addEventListener('custom-value-set', (event) => {
4141
assertType<ComboBoxCustomValueSetEvent>(event);
@@ -74,7 +74,7 @@ assertType<ComboBoxLight>(genericComboBoxLightElement);
7474
const narrowedComboBoxLightElement = genericComboBoxLightElement as ComboBoxLight<TestComboBoxItem>;
7575
assertType<ComboBoxDataProviderMixinClass<TestComboBoxItem>>(narrowedComboBoxLightElement);
7676
assertType<ComboBoxMixinClass<TestComboBoxItem>>(narrowedComboBoxLightElement);
77-
assertType<ThemableMixin>(narrowedComboBoxLightElement);
77+
assertType<ThemableMixinClass>(narrowedComboBoxLightElement);
7878

7979
narrowedComboBoxLightElement.addEventListener('custom-value-set', (event) => {
8080
assertType<ComboBoxLightCustomValueSetEvent>(event);

‎packages/component-base/src/active-mixin.d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import { KeyboardMixinClass } from './keyboard-mixin.js';
1616
* The attribute is removed as soon as the element is deactivated
1717
* by the pointer or by releasing the activation key.
1818
*/
19-
export declare const ActiveMixin: <T extends Constructor<HTMLElement>>(
19+
export declare function ActiveMixin<T extends Constructor<HTMLElement>>(
2020
base: T
21-
) => T & Constructor<ActiveMixinClass> & Constructor<DisabledMixinClass> & Constructor<KeyboardMixinClass>;
21+
): T & Constructor<ActiveMixinClass> & Constructor<DisabledMixinClass> & Constructor<KeyboardMixinClass>;
2222

2323
export declare class ActiveMixinClass {
2424
/**

‎packages/component-base/src/dir-mixin.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Constructor } from '@open-wc/dedupe-mixin';
88
/**
99
* A mixin to handle `dir` attribute based on the one set on the `<html>` element.
1010
*/
11-
export declare const DirMixin: <T extends Constructor<HTMLElement>>(base: T) => T & Constructor<DirMixinClass>;
11+
export declare function DirMixin<T extends Constructor<HTMLElement>>(base: T): T & Constructor<DirMixinClass>;
1212

1313
export declare class DirMixinClass {
1414
protected __getNormalizedScrollLeft(element: Element | null): number;

‎packages/component-base/src/disabled-mixin.d.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import { Constructor } from '@open-wc/dedupe-mixin';
88
/**
99
* A mixin to provide disabled property for field components.
1010
*/
11-
export declare const DisabledMixin: <T extends Constructor<HTMLElement>>(
12-
base: T
13-
) => Constructor<DisabledMixinClass> & T;
11+
export declare function DisabledMixin<T extends Constructor<HTMLElement>>(base: T): Constructor<DisabledMixinClass> & T;
1412

1513
export declare class DisabledMixinClass {
1614
/**

‎packages/component-base/src/focus-mixin.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Constructor } from '@open-wc/dedupe-mixin';
88
/**
99
* A mixin to handle `focused` and `focus-ring` attributes based on focus.
1010
*/
11-
export declare const FocusMixin: <T extends Constructor<HTMLElement>>(base: T) => T & Constructor<FocusMixinClass>;
11+
export declare function FocusMixin<T extends Constructor<HTMLElement>>(base: T): T & Constructor<FocusMixinClass>;
1212

1313
export declare class FocusMixinClass {
1414
protected readonly _keyboardActive: boolean;

‎packages/component-base/src/keyboard-mixin.d.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import { Constructor } from '@open-wc/dedupe-mixin';
1010
* The mixin subscribes to the keyboard events while an actual implementation
1111
* for the event handlers is left to the client (a component or another mixin).
1212
*/
13-
export declare const KeyboardMixin: <T extends Constructor<HTMLElement>>(
14-
base: T
15-
) => T & Constructor<KeyboardMixinClass>;
13+
export declare function KeyboardMixin<T extends Constructor<HTMLElement>>(base: T): T & Constructor<KeyboardMixinClass>;
1614

1715
export declare class KeyboardMixinClass {
1816
/**

‎packages/component-base/src/slot-mixin.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Constructor } from '@open-wc/dedupe-mixin';
88
/**
99
* A mixin to provide content for named slots defined by component.
1010
*/
11-
export declare const SlotMixin: <T extends Constructor<HTMLElement>>(base: T) => T & Constructor<SlotMixinClass>;
11+
export declare function SlotMixin<T extends Constructor<HTMLElement>>(base: T): T & Constructor<SlotMixinClass>;
1212

1313
export declare class SlotMixinClass {
1414
/**

0 commit comments

Comments
 (0)