Merge pull request #1250 from ing-bank/chore/type-annotate-static-get-props
chore: remove @ts-expect-error & add @type {any} to static get props
This commit is contained in:
commit
fa9cdffc8f
22 changed files with 43 additions and 26 deletions
15
.changeset/warm-beds-design.md
Normal file
15
.changeset/warm-beds-design.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
'@lion/collapsible': patch
|
||||||
|
'@lion/combobox': patch
|
||||||
|
'@lion/form-core': patch
|
||||||
|
'@lion/input': patch
|
||||||
|
'@lion/input-amount': patch
|
||||||
|
'@lion/input-date': patch
|
||||||
|
'@lion/input-datepicker': patch
|
||||||
|
'@lion/input-range': patch
|
||||||
|
'@lion/input-stepper': patch
|
||||||
|
'@lion/select-rich': patch
|
||||||
|
'@lion/textarea': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Type static get properties as {any} since the real class fields are typed separately and lit properties are just "configuring". Remove expect error.
|
||||||
|
|
@ -8,8 +8,8 @@ const EVENT = {
|
||||||
* `CustomCollapsible` is a class for custom collapsible element (`<custom-collapsible>` web component).
|
* `CustomCollapsible` is a class for custom collapsible element (`<custom-collapsible>` web component).
|
||||||
* @customElement custom-collapsible
|
* @customElement custom-collapsible
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
export class CustomCollapsible extends LionCollapsible {
|
export class CustomCollapsible extends LionCollapsible {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
transitioning: {
|
transitioning: {
|
||||||
|
|
@ -56,7 +56,9 @@ export class CustomCollapsible extends LionCollapsible {
|
||||||
contentNode.style.setProperty('opacity', '1');
|
contentNode.style.setProperty('opacity', '1');
|
||||||
contentNode.style.setProperty('padding', '12px 0');
|
contentNode.style.setProperty('padding', '12px 0');
|
||||||
contentNode.style.setProperty('max-height', '0px');
|
contentNode.style.setProperty('max-height', '0px');
|
||||||
await new Promise(resolve => requestAnimationFrame(() => resolve()));
|
await /** @type {Promise<void>} */ (new Promise(resolve =>
|
||||||
|
requestAnimationFrame(() => resolve()),
|
||||||
|
));
|
||||||
contentNode.style.setProperty('max-height', expectedHeight);
|
contentNode.style.setProperty('max-height', expectedHeight);
|
||||||
await this._waitForTransition({ contentNode });
|
await this._waitForTransition({ contentNode });
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +107,9 @@ export class CustomCollapsible extends LionCollapsible {
|
||||||
*/
|
*/
|
||||||
async __calculateHeight(contentNode) {
|
async __calculateHeight(contentNode) {
|
||||||
contentNode.style.setProperty('max-height', '');
|
contentNode.style.setProperty('max-height', '');
|
||||||
await new Promise(resolve => requestAnimationFrame(() => resolve()));
|
await /** @type {Promise<void>} */ (new Promise(resolve =>
|
||||||
|
requestAnimationFrame(() => resolve()),
|
||||||
|
));
|
||||||
return this._contentHeight; // Expected height i.e. actual size once collapsed after animation
|
return this._contentHeight; // Expected height i.e. actual size once collapsed after animation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { css, html } from '@lion/core';
|
import { css, html } from '@lion/core';
|
||||||
import { LionButton } from '@lion/button';
|
import { LionButton } from '@lion/button';
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
export class GhButton extends LionButton {
|
export class GhButton extends LionButton {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { renderLitAsNode } from '@lion/helpers';
|
||||||
import { LionCombobox } from '../../src/LionCombobox.js';
|
import { LionCombobox } from '../../src/LionCombobox.js';
|
||||||
import './gh-button.js';
|
import './gh-button.js';
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
export class GhOption extends LionOption {
|
export class GhOption extends LionOption {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@ import { FormControlMixin } from './FormControlMixin.js';
|
||||||
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
||||||
*/
|
*/
|
||||||
const FocusMixinImplementation = superclass =>
|
const FocusMixinImplementation = superclass =>
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
// eslint-disable-next-line no-unused-vars, max-len, no-shadow
|
|
||||||
class FocusMixin extends FormControlMixin(superclass) {
|
class FocusMixin extends FormControlMixin(superclass) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
focused: {
|
focused: {
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ import { ValidateMixin } from './validate/ValidateMixin.js';
|
||||||
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
||||||
*/
|
*/
|
||||||
const FormatMixinImplementation = superclass =>
|
const FormatMixinImplementation = superclass =>
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
class FormatMixin extends ValidateMixin(FormControlMixin(superclass)) {
|
class FormatMixin extends ValidateMixin(FormControlMixin(superclass)) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ import { FormControlMixin } from './FormControlMixin.js';
|
||||||
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
||||||
*/
|
*/
|
||||||
const InteractionStateMixinImplementation = superclass =>
|
const InteractionStateMixinImplementation = superclass =>
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
class InteractionStateMixin extends FormControlMixin(superclass) {
|
class InteractionStateMixin extends FormControlMixin(superclass) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ import { InteractionStateMixin } from './InteractionStateMixin.js'; // applies F
|
||||||
*
|
*
|
||||||
* @customElement lion-field
|
* @customElement lion-field
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error lit properties false positive
|
|
||||||
export class LionField extends FormControlMixin(
|
export class LionField extends FormControlMixin(
|
||||||
InteractionStateMixin(FocusMixin(FormatMixin(ValidateMixin(SlotMixin(LitElement))))),
|
InteractionStateMixin(FocusMixin(FormatMixin(ValidateMixin(SlotMixin(LitElement))))),
|
||||||
) {
|
) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
autocomplete: {
|
autocomplete: {
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ import { InteractionStateMixin } from '../InteractionStateMixin.js';
|
||||||
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
||||||
*/
|
*/
|
||||||
const ChoiceGroupMixinImplementation = superclass =>
|
const ChoiceGroupMixinImplementation = superclass =>
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
class ChoiceGroupMixin extends FormRegistrarMixin(InteractionStateMixin(superclass)) {
|
class ChoiceGroupMixin extends FormRegistrarMixin(InteractionStateMixin(superclass)) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ const hasChanged = (nw, old = {}) => nw.value !== old.value || nw.checked !== ol
|
||||||
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
||||||
*/
|
*/
|
||||||
const ChoiceInputMixinImplementation = superclass =>
|
const ChoiceInputMixinImplementation = superclass =>
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
class ChoiceInputMixin extends FormatMixin(superclass) {
|
class ChoiceInputMixin extends FormatMixin(superclass) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ import { FormElementsHaveNoError } from './FormElementsHaveNoError.js';
|
||||||
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
||||||
*/
|
*/
|
||||||
const FormGroupMixinImplementation = superclass =>
|
const FormGroupMixinImplementation = superclass =>
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
class FormGroupMixin extends FormRegistrarMixin(
|
class FormGroupMixin extends FormRegistrarMixin(
|
||||||
FormControlMixin(ValidateMixin(DisabledMixin(SlotMixin(superclass)))),
|
FormControlMixin(ValidateMixin(DisabledMixin(SlotMixin(superclass)))),
|
||||||
) {
|
) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ function arrayDiff(array1 = [], array2 = []) {
|
||||||
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
* @param {import('@open-wc/dedupe-mixin').Constructor<import('@lion/core').LitElement>} superclass
|
||||||
*/
|
*/
|
||||||
export const ValidateMixinImplementation = superclass =>
|
export const ValidateMixinImplementation = superclass =>
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
class extends FormControlMixin(
|
class extends FormControlMixin(
|
||||||
SyncUpdatableMixin(DisabledMixin(SlotMixin(ScopedElementsMixin(superclass)))),
|
SyncUpdatableMixin(DisabledMixin(SlotMixin(ScopedElementsMixin(superclass)))),
|
||||||
) {
|
) {
|
||||||
|
|
@ -45,6 +44,7 @@ export const ValidateMixinImplementation = superclass =>
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
validators: { attribute: false },
|
validators: { attribute: false },
|
||||||
|
|
|
||||||
|
|
@ -1115,8 +1115,8 @@ export function runValidateMixinSuite(customConfig) {
|
||||||
// TODO: add this test on FormControl layer
|
// TODO: add this test on FormControl layer
|
||||||
it('reconsiders feedback visibility when interaction states changed', async () => {
|
it('reconsiders feedback visibility when interaction states changed', async () => {
|
||||||
const elTagString = defineCE(
|
const elTagString = defineCE(
|
||||||
// @ts-expect-error lit properties false positive, they get merged with parent properties by lit automatically
|
|
||||||
class extends ValidateMixin(LitElement) {
|
class extends ValidateMixin(LitElement) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
modelValue: String,
|
modelValue: String,
|
||||||
|
|
@ -1160,12 +1160,12 @@ export function runValidateMixinSuite(customConfig) {
|
||||||
|
|
||||||
it('filters feedback visibility according interaction states', async () => {
|
it('filters feedback visibility according interaction states', async () => {
|
||||||
const elTagString = defineCE(
|
const elTagString = defineCE(
|
||||||
// @ts-expect-error lit properties false positive, they get merged with parent properties by lit automatically
|
|
||||||
class extends ValidateMixin(LitElement) {
|
class extends ValidateMixin(LitElement) {
|
||||||
static get validationTypes() {
|
static get validationTypes() {
|
||||||
return ['error', 'info'];
|
return ['error', 'info'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
modelValue: { type: String },
|
modelValue: { type: String },
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,8 @@ describe('Validator', () => {
|
||||||
|
|
||||||
it('has access to FormControl', async () => {
|
it('has access to FormControl', async () => {
|
||||||
const lightDom = '';
|
const lightDom = '';
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
class ValidateElement extends ValidateMixin(LitElement) {
|
class ValidateElement extends ValidateMixin(LitElement) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return { modelValue: String };
|
return { modelValue: String };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import { parseAmount } from './parsers.js';
|
||||||
*
|
*
|
||||||
* @customElement lion-input-amount
|
* @customElement lion-input-amount
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
export class LionInputAmount extends LocalizeMixin(LionInput) {
|
export class LionInputAmount extends LocalizeMixin(LionInput) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ function isValidDate(date) {
|
||||||
*
|
*
|
||||||
* @customElement lion-input-date
|
* @customElement lion-input-date
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
export class LionInputDate extends LocalizeMixin(LionInput) {
|
export class LionInputDate extends LocalizeMixin(LionInput) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
modelValue: Date,
|
modelValue: Date,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import { LionCalendarOverlayFrame } from './LionCalendarOverlayFrame.js';
|
||||||
/**
|
/**
|
||||||
* @customElement lion-input-datepicker
|
* @customElement lion-input-datepicker
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
export class LionInputDatepicker extends ScopedElementsMixin(
|
export class LionInputDatepicker extends ScopedElementsMixin(
|
||||||
ArrowMixin(OverlayMixin(LionInputDate)),
|
ArrowMixin(OverlayMixin(LionInputDate)),
|
||||||
) {
|
) {
|
||||||
|
|
@ -24,6 +23,7 @@ export class LionInputDatepicker extends ScopedElementsMixin(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import { formatNumber } from '@lion/localize';
|
||||||
*
|
*
|
||||||
* @customElement `lion-input-range`
|
* @customElement `lion-input-range`
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
export class LionInputRange extends LionInput {
|
export class LionInputRange extends LionInput {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
min: {
|
min: {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import { IsNumber, MinNumber, MaxNumber } from '@lion/form-core';
|
||||||
*
|
*
|
||||||
* @customElement lion-input-stepper
|
* @customElement lion-input-stepper
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive, lit-element already merges properties for you
|
|
||||||
export class LionInputStepper extends LionInput {
|
export class LionInputStepper extends LionInput {
|
||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
|
|
@ -20,6 +19,7 @@ export class LionInputStepper extends LionInput {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
min: {
|
min: {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,10 @@ import { LionField, NativeTextFieldMixin } from '@lion/form-core';
|
||||||
*
|
*
|
||||||
* @customElement lion-input
|
* @customElement lion-input
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
export class LionInput extends NativeTextFieldMixin(
|
||||||
export class LionInput extends NativeTextFieldMixin(LionField) {
|
/** @type {typeof import('@lion/form-core/types/NativeTextFieldMixinTypes').NativeTextField} */ (LionField),
|
||||||
|
) {
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ function detectInteractionMode() {
|
||||||
/**
|
/**
|
||||||
* LionSelectRich: wraps the <lion-listbox> element
|
* LionSelectRich: wraps the <lion-listbox> element
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive for incompatible static get properties. Lit-element merges super properties already for you.
|
|
||||||
export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(LionListbox))) {
|
export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(LionListbox))) {
|
||||||
static get scopedElements() {
|
static get scopedElements() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -33,6 +32,7 @@ export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(L
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {any} */
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
navigateWithinInvoker: {
|
navigateWithinInvoker: {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ class LionFieldWithTextArea extends LionField {
|
||||||
*
|
*
|
||||||
* @customElement lion-textarea
|
* @customElement lion-textarea
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error false positive, parent properties get merged by lit-element already
|
|
||||||
export class LionTextarea extends NativeTextFieldMixin(LionFieldWithTextArea) {
|
export class LionTextarea extends NativeTextFieldMixin(LionFieldWithTextArea) {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue