import type { Component, Ref } from 'vue'; /** * Augment this interface adding types of field descriptors to get type-safety when using helpers */ export interface DescriptorMap { } type DescriptorTypesKeys = keyof DescriptorMap; export type DescriptorType = DescriptorTypesKeys extends never ? string : DescriptorTypesKeys; /** * Augment this interface to add properties into the BaseFieldDescriptor interface */ export interface CustomBaseDescriptorProperties { } export interface BaseDescriptor extends CustomBaseDescriptorProperties { id: string; type: DescriptorType; component?: Component; label: string; model: Ref; } export type DescriptorFactoryFunction = (stateRefs: Record) => ReactiveDescriptorList; /** * Helper type to define FieldDescriptors which don't have extra fields */ export interface SimpleDescriptor extends BaseDescriptor { type: Type; } type DescriptorWithoutIdMap = { [K in keyof DescriptorMap]: Omit; }; export type DescriptorWithoutId = DescriptorWithoutIdMap[keyof DescriptorWithoutIdMap]; export type Descriptor = DescriptorMap[keyof DescriptorMap]; export type ReactiveDescriptorList = Ref | ReactiveDescriptorList[] | Descriptor[] | Descriptor; export type Transformer> = (config: T) => ReactiveDescriptorList; export interface Binding { type: DescriptorType | DescriptorType[]; component: Component; transformer?: Transformer; } export {};