From 7cbd16e23fd004eae7079778e57d019380377f63 Mon Sep 17 00:00:00 2001 From: Patric Eberle Date: Thu, 9 Feb 2023 19:20:59 +0100 Subject: [PATCH] #203 fixes typing issues with e-checkbox --- src/components/e-checkbox.vue | 11 ++++------- src/components/e-table.vue | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/components/e-checkbox.vue b/src/components/e-checkbox.vue index 87ede2a7..2d474862 100644 --- a/src/components/e-checkbox.vue +++ b/src/components/e-checkbox.vue @@ -27,8 +27,6 @@ import useFormStates, { IFormStates, withProps } from '@/compositions/form-states'; import { IModifiers } from '@/plugins/vue-bem-cn/src/globals'; - export type TECheckboxValue = boolean | string | number; - /** * Checkbox component for form elements. * Can be used as single element with a Boolean value or multiple checkboxes with an Array. @@ -46,7 +44,7 @@ * The model value to be used for v-model. */ modelValue: { - type: [Boolean, Number, String, Array] as PropType, + type: [Boolean, Array] as PropType, // eslint-disable-line @typescript-eslint/no-explicit-any -- was not able to find a better solution, since the value is very dynamic required: true, }, @@ -62,7 +60,7 @@ * Adds value attribute. */ value: { - type: [String, Number, Boolean], + type: [String, Number, Boolean] as PropType, // eslint-disable-line @typescript-eslint/no-explicit-any -- was not able to find a better solution, since the value is very dynamic required: true, }, @@ -98,7 +96,6 @@ modifiers(): IModifiers { return { ...this.stateModifiers, - selected: this.internalValue === this.value, variant: this.variant, }; }, @@ -107,10 +104,10 @@ * Sets value of component model to parent model */ internalValue: { - get(): TECheckboxValue | TECheckboxValue[] { + get(): boolean | string[] | number[] { return this.modelValue; }, - set(value: TECheckboxValue) { + set(value: boolean | string[] | number[]) { /** * Emits checkbox value e.g. true/false or value */ diff --git a/src/components/e-table.vue b/src/components/e-table.vue index 80c54716..8907a5c8 100644 --- a/src/components/e-table.vue +++ b/src/components/e-table.vue @@ -193,11 +193,11 @@ ref, } from 'vue'; import eIcon from '@/components/e-icon.vue'; - import eCheckbox, { TECheckboxValue } from '@/components/e-checkbox.vue'; + import eCheckbox from '@/components/e-checkbox.vue'; import useUuid, { IUuid } from '@/compositions/uuid'; import { IModifiers } from '@/plugins/vue-bem-cn/src/globals'; - type TItemId = Extract; + type TItemId = number | string; export interface IETableItem { disabled?: boolean;