Commit a1e69b44 by Vladislav Lagunov

Возможность смены типа формы

parent fc2d2436
...@@ -64,11 +64,11 @@ export type CreateFormOptions<T> = { ...@@ -64,11 +64,11 @@ export type CreateFormOptions<T> = {
export default function createForm<O extends CreateFormOptions<any>>(options: O) { export default function createForm<O extends CreateFormOptions<any>>(options: O) {
type T = O extends CreateFormOptions<infer T> ? T : never; type T = O extends CreateFormOptions<infer T> ? T : never;
function createZoom(self: React.Component<CardProps<T>>) { function createZoom<T2 = T>(self: React.Component<CardProps<T>>) {
function zoom(): FieldProps<T>; function zoom(): FieldProps<T2>;
function zoom<K1 extends keyof T>(...keys: [K1]): FieldProps<T[K1]>; function zoom<K1 extends keyof T2>(...keys: [K1]): FieldProps<T2[K1]>;
function zoom<K1 extends keyof T, K2 extends keyof T[K1]>(...keys: [K1, K2]): FieldProps<T[K1][K2]>; function zoom<K1 extends keyof T2, K2 extends keyof T2[K1]>(...keys: [K1, K2]): FieldProps<T2[K1][K2]>;
function zoom<K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(...keys: [K1, K2, K3]): FieldProps<T[K1][K2][K3]>; function zoom<K1 extends keyof T2, K2 extends keyof T2[K1], K3 extends keyof T2[K1][K2]>(...keys: [K1, K2, K3]): FieldProps<T2[K1][K2][K3]>;
function zoom(...keys) { function zoom(...keys) {
const { dispatch, ctx } = self.props; const { dispatch, ctx } = self.props;
const value = self.props.model.modified || self.props.model.initial; const value = self.props.model.modified || self.props.model.initial;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment