Add type definitions for raven-for-redux (#22710)

This commit is contained in:
Daniel
2018-01-05 15:45:53 -08:00
committed by Mohamed Hegazy
parent fdb86971de
commit b7ca35ab02
5 changed files with 72 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for raven-for-redux 1.1
// Project: https://github.com/captbaritone/raven-for-redux
// Definitions by: Daniel Chiu <https://github.com/chiubaka>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Action, Middleware } from "redux";
import * as Raven from "raven-js";
export = createRavenMiddleware;
declare function createRavenMiddleware(raven: Raven.RavenStatic, options?: createRavenMiddleware.RavenMiddlewareOptions<any>): Middleware;
declare namespace createRavenMiddleware {
interface RavenUserContext {
id?: string;
username?: string;
email?: string;
}
interface RavenMiddlewareOptions<T> {
breadcrumbDataFromAction?: (action: Action) => any;
actionTransformer?: (action: Action) => Action;
stateTransformer?: (state: T) => T;
breadcrumbCategory?: string;
filterBreadcrumbActions?: (action: Action) => boolean;
getUserContext?: (state: T) => RavenUserContext;
}
}
+7
View File
@@ -0,0 +1,7 @@
{
"private": true,
"dependencies": {
"raven-js": ">=3.21.0",
"redux": ">=3.7.2"
}
}
@@ -0,0 +1,13 @@
import * as Raven from "raven-js";
import * as createRavenMiddleware from "raven-for-redux";
import { applyMiddleware, createStore } from "redux";
const middleware = createRavenMiddleware(Raven);
createStore(
() => {
return null;
},
null,
applyMiddleware(middleware)
);
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"raven-for-redux-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }