Added type definitions for use-combined-reducers (#38647)

* Added type definitions for use-combined-reducers

* fixed errors

* fixed typo

* deleted typescript version declaration

* defined the same typescript version as react
This commit is contained in:
kwdowik 2019-09-27 18:06:40 +02:00 committed by Ben Lichtman
parent a6bf231f3f
commit 06484d13df
4 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// Type definitions for use-combined-reducers 1.0
// Project: https://github.com/the-road-to-learn-react/use-combined-reducers#readme
// Definitions by: kwdowik <https://github.com/kwdowik>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export default function useCombinedReducers<T, A>(combinedReducers: Record<keyof T, [T[keyof T], React.Dispatch<A>]>): [T, (action: A) => void];

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",
"use-combined-reducers-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,6 @@
import useCombinedReducers from 'use-combined-reducers';
useCombinedReducers<{ a: number; b: any }, () => {}>({
a: ['', () => { }],
b: ['', () => { }],
});