From a0aac300ebf740324732d5ddae7d815aac0b7ab7 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Fri, 26 Feb 2016 10:51:56 -0800 Subject: [PATCH] Add complex level options. --- redux-logger/redux-logger.d.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts index e04064778..8d02c535e 100644 --- a/redux-logger/redux-logger.d.ts +++ b/redux-logger/redux-logger.d.ts @@ -9,16 +9,27 @@ declare module 'redux-logger' { type LoggerPredicate = (getState: () => any, action: any) => boolean; + type StateToString = (state: any) => string; + type ActionToString = (action: any) => string; + type ErrorToString = (error: any, prevState: any) => string; + interface ColorsObject { - title?: (action: any) => string; - prevState?: (prevState: any) => string; - action?: (action: any) => string; - nextState?: (nextState: any) => string; - error?: (error: any, prevState: any) => string; + title?: boolean | ActionToString; + prevState?: boolean | StateToString; + action?: boolean | ActionToString; + nextState?: boolean | StateToString; + error?: boolean | ErrorToString; + } + + interface LevelObject { + prevState?: string | boolean | StateToString; + action?: string | boolean | ActionToString; + nextState?: string | boolean | StateToString; + error?: string | boolean | ErrorToString; } interface ReduxLoggerOptions { - level?: string; + level?: string | ActionToString | LevelObject; duration?: boolean; timestamp?: boolean; colors?: ColorsObject;