|
| 1 | +// Type definitions for redux-logger v2.6.0 |
| 2 | +// Project: https://github.com/fcomb/redux-logger |
| 3 | +// Definitions by: Alexander Rusakov <https://github.com/arusakov/> |
| 4 | +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped |
| 5 | + |
| 6 | +/// <reference path="../redux/redux.d.ts" /> |
| 7 | + |
| 8 | +declare module 'redux-logger' { |
| 9 | + |
| 10 | + type LoggerPredicate = (getState: () => any, action: any) => boolean; |
| 11 | + |
| 12 | + type StateToString = (state: any) => string; |
| 13 | + type ActionToString = (action: any) => string; |
| 14 | + type ErrorToString = (error: any, prevState: any) => string; |
| 15 | + |
| 16 | + interface ColorsObject { |
| 17 | + title?: boolean | ActionToString; |
| 18 | + prevState?: boolean | StateToString; |
| 19 | + action?: boolean | ActionToString; |
| 20 | + nextState?: boolean | StateToString; |
| 21 | + error?: boolean | ErrorToString; |
| 22 | + } |
| 23 | + |
| 24 | + interface LevelObject { |
| 25 | + prevState?: string | boolean | StateToString; |
| 26 | + action?: string | boolean | ActionToString; |
| 27 | + nextState?: string | boolean | StateToString; |
| 28 | + error?: string | boolean | ErrorToString; |
| 29 | + } |
| 30 | + |
| 31 | + interface ReduxLoggerOptions { |
| 32 | + level?: string | ActionToString | LevelObject; |
| 33 | + duration?: boolean; |
| 34 | + timestamp?: boolean; |
| 35 | + colors?: ColorsObject; |
| 36 | + logger?: any; |
| 37 | + logErrors?: boolean; |
| 38 | + collapsed?: boolean | LoggerPredicate; |
| 39 | + predicate?: LoggerPredicate; |
| 40 | + stateTransformer?: (state: any) => any; |
| 41 | + actionTransformer?: (action: any) => any; |
| 42 | + errorTransformer?: (error: any) => any; |
| 43 | + } |
| 44 | + |
| 45 | + // Trickery to get TypeScript to accept that our anonymous, non-default export is a function. |
| 46 | + // see https://github.com/Microsoft/TypeScript/issues/3612 for more |
| 47 | + namespace createLogger {} |
| 48 | + function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; |
| 49 | + export = createLogger; |
| 50 | +} |
0 commit comments