Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import { Middleware } from 'redux';
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?: 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 | ActionToString | LevelObject;
duration?: boolean;
timestamp?: boolean;
colors?: ColorsObject;
logger?: any;
logErrors?: boolean;
collapsed?: boolean | LoggerPredicate;
predicate?: LoggerPredicate;
stateTransformer?: (state: any) => any;
actionTransformer?: (action: any) => any;
errorTransformer?: (error: any) => any;
diff?: boolean;
diffPredicate?: LoggerPredicate;
}
function createLogger(options?: ReduxLoggerOptions): Middleware;
export default createLogger;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment