Skip to content

Commit

Permalink
fix: add typing for reactive functions
Browse files Browse the repository at this point in the history
  • Loading branch information
cafadev committed Jul 28, 2024
1 parent b3357d9 commit bff23d8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
4 changes: 2 additions & 2 deletions packages/vue/src/forms/typing/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export interface UseForm<T, U, S, RecordObjectValueType extends RecordObjectValu
}

export interface Args<T, U, S, RecordObjectValueType extends RecordObjectValue = RecordObjectValue> {
fields: ArgProxy<InferRawModelValue<T, NonNullable<RecordObjectValueType>>>
fields: ArgProxy<InferRawModelValue<T, NonNullable<RecordObjectValueType>>, UseForm<T, U, S, RecordObjectValueType>>
id?: string
buttons?: ArgProxy<U>
buttons?: ArgProxy<U, UseForm<T, U, S, RecordObjectValueType>>
settings?: ArgProxy<S, UseForm<T, U, S, RecordObjectValueType>>
rulesConfig?: RuleConfigState
responseInterceptor?: ResponseInterceptorState
Expand Down
41 changes: 21 additions & 20 deletions packages/vue/src/tables/typing/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,6 @@ import type { ArgProxy } from '@packages/vue/common'

type MappedRawColumnsOrder<S extends RawTableSettings, U> = S & { columnsOrder?: (keyof U | '...')[] }
type MappedNormalizedColumnsOrder<S, U> = Omit<S, 'columnsOrder'> & NormalizedTableSettings & { columnsOrder: (keyof U | '...')[] }
export interface TableArgs<
T extends BaseTableForm,
U,
S extends RawTableSettings,
F,
B extends RawTableButtons,
L,
P extends RawTablePagination,
RecordType = any,
> {
id?: string
form?: T
columns?: ArgProxy<MappedRawColumn<T['fields'], U>>
pagination?: ArgProxy<P>
settings?: ArgProxy<MappedRawColumnsOrder<S, MappedRawColumn<T['fields'], U>>>
filterParams?: ArgProxy<F>
buttons?: ArgProxy<B>
list?: ArgProxy<RawTableList<L>>
record?: RecordType
}

export interface UseTable<
T extends BaseTableForm,
Expand All @@ -45,6 +25,27 @@ export interface UseTable<
record: RecordType
}

export interface TableArgs<
T extends BaseTableForm,
U,
S extends RawTableSettings,
F,
B extends RawTableButtons,
L,
P extends RawTablePagination,
RecordType = any,
> {
id?: string
form?: T
columns?: ArgProxy<MappedRawColumn<T['fields'], U>, UseTable<T, U, S, F, B, L, P, RecordType>>
pagination?: ArgProxy<P, UseTable<T, U, S, F, B, L, P, RecordType>>
settings?: ArgProxy<MappedRawColumnsOrder<S, MappedRawColumn<T['fields'], U>>, UseTable<T, U, S, F, B, L, P, RecordType>>
filterParams?: ArgProxy<F, UseTable<T, U, S, F, B, L, P, RecordType>>
buttons?: ArgProxy<B, UseTable<T, U, S, F, B, L, P, RecordType>>
list?: ArgProxy<RawTableList<L>, UseTable<T, U, S, F, B, L, P, RecordType>>
record?: RecordType
}

export interface TableBodyProps {
items: any[]
headers: NormalizedColumn[]
Expand Down

0 comments on commit bff23d8

Please sign in to comment.