Update typings for redux-logger to 2.6.0.

This commit is contained in:
Sean Kelley
2016-02-25 15:00:33 -08:00
parent 98f53ca08e
commit 81e4e35ea7
+28 -11
View File
@@ -1,4 +1,4 @@
// Type definitions for redux-logger v2.0.0
// Type definitions for redux-logger v2.6.0
// Project: https://github.com/fcomb/redux-logger
// Definitions by: Alexander Rusakov <https://github.com/arusakov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -7,16 +7,33 @@
declare module 'redux-logger' {
interface ReduxLoggerOptions {
actionTransformer?: (action: any) => any;
collapsed?: boolean;
duration?: boolean;
level?: string;
logger?: any;
predicate?: (getState: Function, action: any) => boolean;
timestamp?: boolean;
stateTransformer?: (state: any) => any;
type LoggerPredicate = (getState: () => any, action: any) => boolean;
interface ColorsObject {
title?: (action: any) => string;
prevState?: (prevState: any) => string;
action?: (action: any) => string;
nextState?: (nextState: any) => string;
error?: (error: any, prevState: any) => string;
}
export function createLogger(options?: ReduxLoggerOptions): Redux.Middleware;
interface ReduxLoggerOptions {
level?: string;
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;
}
// Trickery to get TypeScript to accept that our anonymous, non-default export is a function.
// see https://github.com/Microsoft/TypeScript/issues/3612 for more
namespace createLogger {}
function createLogger(options?: ReduxLoggerOptions): Redux.Middleware;
export = createLogger;
}