Skip to content

Commit

Permalink
fix FieldSet types [ci skip] (#1247)
Browse files Browse the repository at this point in the history
  • Loading branch information
intellild authored and cpylua committed Nov 14, 2019
1 parent 317bd2c commit 33b2f4c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/zent/src/form/FieldSet.tsx
Expand Up @@ -9,10 +9,10 @@ import {
FieldSetModel,
} from 'formulr';
import {
IFormFieldModelDrivenProps,
IRenderError,
defaultRenderError,
asFormChild,
IFormFieldViewDrivenProps,
} from './shared';

export interface IFieldSetProps<T extends Record<string, BasicModel<unknown>>> {
Expand All @@ -27,12 +27,9 @@ export interface IFieldSetProps<T extends Record<string, BasicModel<unknown>>> {

export function FieldSet<T extends Record<string, BasicModel<unknown>>>(
props: IFieldSetProps<T> &
IFormFieldModelDrivenProps<T> & { model: FieldSetModel<T> }
IFormFieldViewDrivenProps<T> & { model: FieldSetModel<T> }
) {
const [ctx, model] = useFieldSet(
(props as any).name || (props as any).model,
props.validators
);
const [ctx, model] = useFieldSet(props.name || props.model, props.validators);
const { scrollAnchorRef, renderError = defaultRenderError } = props;
asFormChild(model as BasicModel<unknown>, scrollAnchorRef);
useValue$(model.error$, model.error$.getValue());
Expand Down

0 comments on commit 33b2f4c

Please sign in to comment.