mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
updating redux-immutable-state-invariant types (#35875)
This commit is contained in:
parent
1f13d82744
commit
d38d5b4a42
14
types/redux-immutable-state-invariant/index.d.ts
vendored
14
types/redux-immutable-state-invariant/index.d.ts
vendored
@ -1,12 +1,20 @@
|
||||
// Type definitions for redux-immutable-state-invariant 2.1
|
||||
// Project: https://github.com/leoasis/redux-immutable-state-invariant
|
||||
// Definitions by: Remo H. Jansen <https://github.com/remojansen>, Ben Rogers <https://github.com/highflying>, Mihai Dinculescu <https://github.com/mihai-dinculescu>
|
||||
// Definitions by: Remo H. Jansen <https://github.com/remojansen>
|
||||
// Ben Rogers <https://github.com/highflying>
|
||||
// Mihai Dinculescu <https://github.com/mihai-dinculescu>
|
||||
// Nick Galloway <https://github.com/blackarctic>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Redux from "redux";
|
||||
|
||||
type isImmutableDefault = (value: any) => boolean;
|
||||
type immutableStateInvariantMiddlewareInterface = (isImmutable?: isImmutableDefault) => Redux.Middleware;
|
||||
interface immutableStateInvariantMiddlewareOptions {
|
||||
isImmutable?: (value: any) => boolean;
|
||||
ignore?: string[];
|
||||
}
|
||||
type immutableStateInvariantMiddlewareInterface = (
|
||||
options?: immutableStateInvariantMiddlewareOptions,
|
||||
) => Redux.Middleware;
|
||||
declare let immutableStateInvariantMiddleware: immutableStateInvariantMiddlewareInterface;
|
||||
export default immutableStateInvariantMiddleware;
|
||||
|
||||
@ -1,4 +1,30 @@
|
||||
import { applyMiddleware } from "redux";
|
||||
import immutableStateInvariantMiddleware from "redux-immutable-state-invariant";
|
||||
|
||||
// without options
|
||||
applyMiddleware(immutableStateInvariantMiddleware());
|
||||
|
||||
// with an empty options object
|
||||
applyMiddleware(immutableStateInvariantMiddleware({}));
|
||||
|
||||
// with isImmutable option
|
||||
applyMiddleware(immutableStateInvariantMiddleware({
|
||||
isImmutable: (val) => val === 'something'
|
||||
}));
|
||||
|
||||
// with ignore option
|
||||
applyMiddleware(immutableStateInvariantMiddleware({
|
||||
ignore: [
|
||||
'foo',
|
||||
'bar.thingsToIgnore'
|
||||
]
|
||||
}));
|
||||
|
||||
// with all options
|
||||
applyMiddleware(immutableStateInvariantMiddleware({
|
||||
isImmutable: (val) => val === 'something',
|
||||
ignore: [
|
||||
'foo',
|
||||
'bar.thingsToIgnore'
|
||||
]
|
||||
}));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user