Skip to content

Commit

Permalink
#203 fixes typing issues with e-checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
patric-eberle committed Feb 9, 2023
1 parent ad12097 commit 7cbd16e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/components/e-checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -46,7 +44,7 @@
* The model value to be used for v-model.
*/
modelValue: {
type: [Boolean, Number, String, Array] as PropType<TECheckboxValue | TECheckboxValue[]>,
type: [Boolean, Array] as PropType<any>, // eslint-disable-line @typescript-eslint/no-explicit-any -- was not able to find a better solution, since the value is very dynamic
required: true,
},
Expand All @@ -62,7 +60,7 @@
* Adds value attribute.
*/
value: {
type: [String, Number, Boolean],
type: [String, Number, Boolean] as PropType<any>, // eslint-disable-line @typescript-eslint/no-explicit-any -- was not able to find a better solution, since the value is very dynamic
required: true,
},
Expand Down Expand Up @@ -98,7 +96,6 @@
modifiers(): IModifiers {
return {
...this.stateModifiers,
selected: this.internalValue === this.value,
variant: this.variant,
};
},
Expand All @@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions src/components/e-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<TECheckboxValue, number | string>;
type TItemId = number | string;
export interface IETableItem {
disabled?: boolean;
Expand Down

0 comments on commit 7cbd16e

Please sign in to comment.