通用工具类型
This commit is contained in:
parent
c33ccc6d5f
commit
43b445c10b
14
src/core/types.ts
Normal file
14
src/core/types.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { Dispatch, SetStateAction } from "react";
|
||||||
|
|
||||||
|
export type ValueGetter<T> = () => T;
|
||||||
|
export type ValueSetter<T> = (value: T) => void;
|
||||||
|
|
||||||
|
export type AsyncGetter<T> = () => Promise<T>;
|
||||||
|
export type AsyncSetter<T> = (value: T) => Promise<void>;
|
||||||
|
|
||||||
|
export type Validator<T> = (value: T) => boolean;
|
||||||
|
export type AsyncValidator<T> = (value: T) => Promise<boolean>;
|
||||||
|
|
||||||
|
export type Transformer<T, R> = (value: T) => R;
|
||||||
|
|
||||||
|
export type SetState<T> = Dispatch<SetStateAction<T>>;
|
||||||
Loading…
x
Reference in New Issue
Block a user