Skip to content

Commit

Permalink
docs(core): fix Type declaration errors in the document and code of s…
Browse files Browse the repository at this point in the history
…etFieldState method (#1605)

* doc(core): fix ts errors in the doc and code of setfieldstate method

* docs(core): fix Type declaration errors in the document and code of setFieldState method

* docs(core): fix Type declaration errors
  • Loading branch information
li9269391 authored Jun 19, 2021
1 parent 1ea4b3f commit bb4f175
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/core/docs/api/models/Form.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ IFormState 参考 [IFormState](#iformstate)

```ts
interface setFieldState {
(pattern: FormPathPattern, state: IGeneralFieldState): void
(callback: (state: IGeneralFieldState) => void): void
(pattern: FormPathPattern, setter: (state: IGeneralFieldState) => void): void
(pattern: FormPathPattern, setter: IGeneralFieldState): void
}
```

Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,12 @@ export type FieldMatchPattern = FormPathPattern | Query | GeneralField
export interface IFieldStateSetter {
(pattern: FieldMatchPattern, setter: (state: IFieldState) => void): void
(pattern: FieldMatchPattern, setter: Partial<IFieldState>): void
(pattern: FieldMatchPattern): void
}

export interface IFieldStateGetter {
<Getter extends (state: IFieldState) => any>(
<Getter extends (state: IGeneralFieldState) => any>(
pattern: FieldMatchPattern,
getter: Getter
): ReturnType<Getter>
(pattern: FieldMatchPattern): IFieldState
(pattern: FieldMatchPattern): IGeneralFieldState
}

0 comments on commit bb4f175

Please sign in to comment.