diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-26 01:56:04 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-26 01:56:04 +0300 |
commit | ef742ea9b2f246f74eae74169675a331679ad41c (patch) | |
tree | 693e92f3e6c2897038875550a12bbc1191b6d5c0 /src/lib | |
parent | 865b41114060765308d560181f4996c0aa7a3e74 (diff) | |
download | commercel-ui-ef742ea9b2f246f74eae74169675a331679ad41c.tar.gz |
feat: add strong typing where possible
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ServiceContext.tsx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/ServiceContext.tsx b/src/lib/ServiceContext.tsx index 93cac4e..f7170d1 100644 --- a/src/lib/ServiceContext.tsx +++ b/src/lib/ServiceContext.tsx @@ -7,22 +7,22 @@ export interface Action extends ButtonProps { name: string; } -export interface PanelProps { - item: any; - mutate: (item: any) => void; +export interface PanelProps<T> { + item: T; + mutate: (item: T) => void; } -export interface ServiceParams { +export interface ServiceParams<T = any> { route: string; name: string; tableFields: Field[]; nameSingular?: string; - default?: Record<string, any>; + default?: Partial<T>; routes?: Record<string, React.FC>; actions?: Action[]; - rowLink?: (item: any) => string; - Form?: React.FC<FormikProps<any>>; - Panel?: React.FC<PanelProps>; + rowLink?: (item: T) => string; + Form?: React.FC<FormikProps<T>>; + Panel?: React.FC<PanelProps<T>>; } const ServiceContext = React.createContext<ServiceParams>({ |