Skip to content

Commit

Permalink
added definitions for redux-subscriber (DefinitelyTyped#44534)
Browse files Browse the repository at this point in the history
* added definitions for redux-subscriber

* added one set of functions to the tests

* Update types/redux-subscriber/index.d.ts

Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <[email protected]>

Co-authored-by: Nathan Shively-Sanders <[email protected]>
Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <[email protected]>
  • Loading branch information
3 people authored May 11, 2020
1 parent 11cd024 commit 6684c8c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
11 changes: 11 additions & 0 deletions types/redux-subscriber/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Type definitions for redux-subscriber 1.1
// Project: https://github.com/ivantsov/redux-subscriber#readme
// Definitions by: thisissami <https://github.com/thisissami>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export type Unsubscribe = () => void;
export type Subscribe = (key: string, cb: (state: any) => void) => Unsubscribe;

export default function(store: any): Subscribe;

export const subscribe: Subscribe;
8 changes: 8 additions & 0 deletions types/redux-subscriber/redux-subscriber-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import initSubscriber, { subscribe, Subscribe, Unsubscribe } from 'redux-subscriber';

const subscribe2: Subscribe = initSubscriber({});
const unsubscribe: Unsubscribe = subscribe('', state => {});
const unsubscribe2: Unsubscribe = subscribe2('', state => {});

unsubscribe();
unsubscribe2();
23 changes: 23 additions & 0 deletions types/redux-subscriber/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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",
"redux-subscriber-tests.ts"
]
}
1 change: 1 addition & 0 deletions types/redux-subscriber/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

0 comments on commit 6684c8c

Please sign in to comment.