From 46a10ffe4ebab0328c8fd0cac92f8e632d7d42f7 Mon Sep 17 00:00:00 2001 From: Hossein Dehnokhalaji Date: Fri, 1 Mar 2019 20:51:16 +0000 Subject: [PATCH] Improve type definition namings (#59) --- index.d.ts | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/index.d.ts b/index.d.ts index fa5d2065..e613085f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,41 +3,35 @@ import { SvgIconProps } from '@material-ui/core/SvgIcon'; import { SnackbarProps, SnackbarClassKey } from '@material-ui/core/Snackbar'; type Omit = Pick> +type ClassNameMap = Record; export type VariantType = 'default' | 'error' | 'success' | 'warning' | 'info'; export interface OptionsObject extends Omit { key?: string | number; variant?: VariantType; - persist?: boolean; + persist?: boolean; onClickAction?: Function; preventDuplicate?: boolean; } -type NotistackClassKey = 'variantSuccess' - | 'variantError' - | 'variantInfo' - | 'variantWarning'; +export type NotistackClassKey = 'variantSuccess' | 'variantError' | 'variantInfo' | 'variantWarning'; -// class keys for both MUI and notistack -export type CombinedClassKey = NotistackClassKey | SnackbarClassKey; +type CombinedClassKey = NotistackClassKey | SnackbarClassKey; -export interface InjectedNotistackProps { +export interface withSnackbarProps { onPresentSnackbar: (variant: VariantType, message: string) => void; enqueueSnackbar: (message: string | React.ReactNode, options?: OptionsObject) => string | number | null; closeSnackbar: (key: string | number) => void } -export function withSnackbar

(component: React.ComponentType

): - React.ComponentClass> & { WrappedComponent: React.ComponentType

}; +export function withSnackbar

(component: React.ComponentType

): + React.ComponentClass> & { WrappedComponent: React.ComponentType

}; -export type ClassNameMap = Record; - -/** all MUI props, including class keys for notistack and MUI with additional notistack props */ -export interface SnackbarProviderProps - extends Omit { +// all material-ui props, including class keys for notistack and material-ui with additional notistack props +export interface SnackbarProviderProps extends Omit { classes?: Partial>; - maxSnack: number; + maxSnack?: number; iconVariant?: React.ComponentType; hideIconVariant?: boolean; onClickAction?: Function;