diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..740bf8f --- /dev/null +++ b/index.d.ts @@ -0,0 +1,18 @@ +// See https://github.com/xuoe/redux-observers/issues/5 +import { Dispatch, Store, Unsubscribe } from 'redux'; + +export function shallowEquals(a: any, b: any): boolean; + +interface Options { + skipInitialCall?: boolean; + equals?: typeof shallowEquals; +} + +type Observer = unknown; +type Mapper = (state: S) => MS; +type Dispatcher = (dispatch: Dispatch, currentState: MS, previousState: MS) => unknown; + +export function observer(mapper: Mapper, dispatcher: Dispatcher, options?: Options): Observer; +export function observer(dispatcher: Dispatcher, options?: Options): Observer; + +export function observe(store: Store, observers: Observer[], options?: Options): Unsubscribe; diff --git a/package.json b/package.json index d4a40bd..e8fc771 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "license": "MIT", "main": "lib/index.js", "jsnext:main": "src/index.js", + "types": "index.d.ts", "scripts": { "build": "babel src --out-dir lib", "clean": "rimraf lib coverage", @@ -37,5 +38,8 @@ "keywords": [ "redux", "observer" - ] + ], + "dependencies": { + "@types/redux": "^3.6.0" + } }