frontend/app/components/ui/table/utils.ts

13 lines
313 B
TypeScript
Raw Normal View History

import type { Updater } from "@tanstack/vue-table";
import type { Ref } from "vue";
export function valueUpdater<T extends Updater<any>>(
updaterOrValue: T,
ref: Ref,
) {
ref.value =
typeof updaterOrValue === "function"
? updaterOrValue(ref.value)
: updaterOrValue;
}