Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Improve Flow coverage (#105)
Browse files Browse the repository at this point in the history
* Upgrade dependencies

* Improve Flow coverage

* Upgrade dependencies
  • Loading branch information
AlexMSmithCA authored May 14, 2018
1 parent 9f53f03 commit b02fea3
Show file tree
Hide file tree
Showing 11 changed files with 670 additions and 310 deletions.
95 changes: 95 additions & 0 deletions flow-typed/npm/redux_v4.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// flow-typed signature: cca4916b0213065533df8335c3285a4a
// flow-typed version: cab04034e7/redux_v3.x.x/flow_>=v0.55.x

/* eslint-disable */

declare module 'redux' {
/*
S = State
A = Action
D = Dispatch
*/

declare export type DispatchAPI<A> = (action: A) => A;
declare export type Dispatch<A: {type: $Subtype<string>}> = DispatchAPI<A>;

declare export type MiddlewareAPI<S, A, D = Dispatch<A>> = {
dispatch: D,
getState(): S,
};

declare export type Store<S, A, D = Dispatch<A>> = {
// rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages)
dispatch: D,
getState(): S,
subscribe(listener: () => void): () => void,
replaceReducer(nextReducer: Reducer<S, A>): void,
};

declare export type Reducer<S, A> = (state: S | void, action: A) => S;

declare export type CombinedReducer<S, A> = (
state: ($Shape<S> & {}) | void,
action: A
) => S;

declare export type Middleware<S, A, D = Dispatch<A>> = (
api: MiddlewareAPI<S, A, D>
) => (next: D) => D;

declare export type StoreCreator<S, A, D = Dispatch<A>> = {
(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>,
(
reducer: Reducer<S, A>,
preloadedState: S,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>,
};

declare export type StoreEnhancer<S, A, D = Dispatch<A>> = (
next: StoreCreator<S, A, D>
) => StoreCreator<S, A, D>;

declare export function createStore<S, A, D>(
reducer: Reducer<S, A>,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>;
declare export function createStore<S, A, D>(
reducer: Reducer<S, A>,
preloadedState?: S,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>;

declare export function applyMiddleware<S, A, D>(
...middlewares: Array<Middleware<S, A, D>>
): StoreEnhancer<S, A, D>;

declare export type ActionCreator<A, B> = (...args: Array<B>) => A;
declare export type ActionCreators<K, A> = {[key: K]: ActionCreator<A, any>};

declare export function bindActionCreators<
A,
C: ActionCreator<A, any>,
D: DispatchAPI<A>
>(
actionCreator: C,
dispatch: D
): C;
declare export function bindActionCreators<
A,
K,
C: ActionCreators<K, A>,
D: DispatchAPI<A>
>(
actionCreators: C,
dispatch: D
): C;

declare export function combineReducers<O: Object, A>(
reducers: O
): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;

declare export var compose: $Compose;
}
16 changes: 16 additions & 0 deletions flow-typed/redux-reactors_v1.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @flow

/* eslint-disable */

declare module 'redux-reactors' {
import type {Reducer, StoreCreator} from 'redux';

declare type Reactor<TType, TPayload> = (payload: TPayload) => ({
type: TType,
payload: TPayload,
__REACTOR__: boolean
});
declare function createReactor<TType>(type: TType, reducer: Reducer<*, *>): Reactor<TType, *>;

declare function reactorEnhancer(createStore: StoreCreator<*, *, *>): StoreCreator<*, *, *>;
}
105 changes: 105 additions & 0 deletions flow-typed/tape-cup_v4.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/* eslint-disable */

declare type tape$TestOpts = {
skip: boolean,
timeout?: number,
} | {
skip?: boolean,
timeout: number,
};

declare type tape$TestCb = (t: tape$Context) => mixed;
declare type tape$TestFn = (a: string | tape$TestOpts | tape$TestCb, b?: tape$TestOpts | tape$TestCb, c?: tape$TestCb) => void;

declare interface tape$Context {
fail(msg?: string): void,
pass(msg?: string): void,

error(err: mixed, msg?: string): void,
ifError(err: mixed, msg?: string): void,
ifErr(err: mixed, msg?: string): void,
iferror(err: mixed, msg?: string): void,

ok(value: mixed, msg?: string): void,
true(value: mixed, msg?: string): void,
assert(value: mixed, msg?: string): void,

notOk(value: mixed, msg?: string): void,
false(value: mixed, msg?: string): void,
notok(value: mixed, msg?: string): void,

// equal + aliases
equal(actual: mixed, expected: mixed, msg?: string): void,
equals(actual: mixed, expected: mixed, msg?: string): void,
isEqual(actual: mixed, expected: mixed, msg?: string): void,
is(actual: mixed, expected: mixed, msg?: string): void,
strictEqual(actual: mixed, expected: mixed, msg?: string): void,
strictEquals(actual: mixed, expected: mixed, msg?: string): void,

// notEqual + aliases
notEqual(actual: mixed, expected: mixed, msg?: string): void,
notEquals(actual: mixed, expected: mixed, msg?: string): void,
notStrictEqual(actual: mixed, expected: mixed, msg?: string): void,
notStrictEquals(actual: mixed, expected: mixed, msg?: string): void,
isNotEqual(actual: mixed, expected: mixed, msg?: string): void,
isNot(actual: mixed, expected: mixed, msg?: string): void,
not(actual: mixed, expected: mixed, msg?: string): void,
doesNotEqual(actual: mixed, expected: mixed, msg?: string): void,
isInequal(actual: mixed, expected: mixed, msg?: string): void,

// deepEqual + aliases
deepEqual(actual: mixed, expected: mixed, msg?: string): void,
deepEquals(actual: mixed, expected: mixed, msg?: string): void,
isEquivalent(actual: mixed, expected: mixed, msg?: string): void,
same(actual: mixed, expected: mixed, msg?: string): void,

// notDeepEqual
notDeepEqual(actual: mixed, expected: mixed, msg?: string): void,
notEquivalent(actual: mixed, expected: mixed, msg?: string): void,
notDeeply(actual: mixed, expected: mixed, msg?: string): void,
notSame(actual: mixed, expected: mixed, msg?: string): void,
isNotDeepEqual(actual: mixed, expected: mixed, msg?: string): void,
isNotDeeply(actual: mixed, expected: mixed, msg?: string): void,
isNotEquivalent(actual: mixed, expected: mixed, msg?: string): void,
isInequivalent(actual: mixed, expected: mixed, msg?: string): void,

// deepLooseEqual
deepLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
looseEqual(actual: mixed, expected: mixed, msg?: string): void,
looseEquals(actual: mixed, expected: mixed, msg?: string): void,

// notDeepLooseEqual
notDeepLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
notLooseEqual(actual: mixed, expected: mixed, msg?: string): void,
notLooseEquals(actual: mixed, expected: mixed, msg?: string): void,

throws(fn: Function, expected?: RegExp | Function, msg?: string): void,
doesNotThrow(fn: Function, expected?: RegExp | Function, msg?: string): void,

timeoutAfter(ms: number): void,

skip(msg?: string): void,
plan(n: number): void,
onFinish(fn: Function): void,
end(): void,
comment(msg: string): void,
test: tape$TestFn,
}

declare module 'tape-cup' {
declare type TestHarness = Tape;
declare type StreamOpts = {
objectMode?: boolean,
};

declare type Tape = {
(a: string | tape$TestOpts | tape$TestCb, b?: tape$TestCb | tape$TestOpts, c?: tape$TestCb, ...rest: Array<void>): void,
test: tape$TestFn,
skip: (name: string, cb?: tape$TestCb) => void,
createHarness: () => TestHarness,
createStream: (opts?: StreamOpts) => stream$Readable,
only: (a: string | tape$TestOpts | tape$TestCb, b?: tape$TestCb | tape$TestOpts, c?: tape$TestCb, ...rest: Array<void>) => void,
};

declare module.exports: Tape;
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"./dist/browser.es2015.es.js": "./dist/browser.es2017.es.js"
},
"dependencies": {
"fusion-plugin-rpc": "^1.1.0",
"fusion-rpc-redux": "^1.0.2"
"fusion-plugin-rpc": "^1.2.1",
"fusion-rpc-redux": "^1.1.2"
},
"peerDependencies": {
"fusion-core": "^1.2.6",
Expand All @@ -35,22 +35,22 @@
"devDependencies": {
"babel-eslint": "^8.2.3",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"create-universal-package": "^3.4.1",
"create-universal-package": "^3.4.4",
"eslint": "^4.19.1",
"eslint-config-fusion": "^1.0.1",
"eslint-plugin-cup": "^1.0.0",
"eslint-plugin-cup": "^1.0.2",
"eslint-plugin-flowtype": "^2.46.3",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react": "^7.8.2",
"flow-bin": "^0.72.0",
"fusion-core": "^1.2.6",
"fusion-plugin-universal-events": "^1.0.3",
"fusion-react": "^1.0.4",
"fusion-react-async": "^1.2.2",
"fusion-test-utils": "^1.0.5",
"fusion-tokens": "^1.0.3",
"nyc": "^11.7.1",
"nyc": "^11.7.3",
"prettier": "1.12.1",
"prop-types": "^15.6.1",
"react": "^16.3.2",
Expand Down
Loading

0 comments on commit b02fea3

Please sign in to comment.