Skip to content

Commit

Permalink
fix: typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rdjanuar committed Jan 9, 2025
1 parent 0bef321 commit 3add3ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/runtime/components/InputMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,11 @@ function onUpdateOpen(value: boolean) {
}
function onRemoveTag(event: any) {
const modelValue = props.modelValue as SelectModelValue<T, V, M>[]
const filteredValue = modelValue.filter(value => !isEqual(value, event))
emits('update:modelValue', filteredValue)
if (Array.isArray(props.modelValue)) {
const modelValue = props.modelValue
const filteredValue = modelValue.filter(value => !isEqual(value, event))
emits('update:modelValue', filteredValue as SelectModelValue<T, V, M>)
}
}
defineExpose({
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export type PartialString<T> = {
[K in keyof T]?: string
}

export type MaybeArray<T> = T | T[]
export type MaybeArrayOfArray<T> = T[] | T[][]
export type MaybeArrayOfArrayItem<I> = I extends Array<infer T> ? T extends Array<infer U> ? U : T : never

Expand All @@ -32,5 +31,5 @@ export type SelectModelValue<T, V, M extends boolean = false, DV = T> = (T exten
export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string

export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
'update:modelValue': [payload: MaybeArray<SelectModelValue<T, V, M, DV>>]
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>]
}

0 comments on commit 3add3ca

Please sign in to comment.