Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Examples give flow errors, (Flowtypes incorrect?) #268

Closed
ZwaarContrast opened this issue Feb 8, 2018 · 1 comment
Closed

Examples give flow errors, (Flowtypes incorrect?) #268

ZwaarContrast opened this issue Feb 8, 2018 · 1 comment

Comments

@ZwaarContrast
Copy link

ZwaarContrast commented Feb 8, 2018

Using the example from the README with Flow:

// @flow
import { routerForBrowser } from 'redux-little-router'

const { reducer, middleware, enhancer } = routerForBrowser({
    routes
})

Results in Flow errors:

message: 'object literal (This type is incompatible with the expected param type of BrowserRouterArgs Property `basename` is incompatible:)'
message: 'object literal (This type is incompatible with the expected param type of BrowserRouterArgs Property `historyOptions` is incompatible:)'
message: 'object literal (This type is incompatible with the expected param type of BrowserRouterArgs Property `history` is incompatible:)'

I'm no flow expert, I just starting to use it, but if arguments are truly optional as they seem to be, shouldn't the type for BrowserRouterArgs be:

type BrowserRouterArgs = {
  routes: Object,
  basename?: string,
  historyOptions?: BrowserHistoryOptions,
  history?: History
};

instead of:

type BrowserRouterArgs = {
  routes: Object,
  basename: string,
  historyOptions: BrowserHistoryOptions,
  history: History
};
@avogel3
Copy link

avogel3 commented Mar 15, 2018

+1, Just started with flow as well, and I've been having this same issue on a fresh project using:

  • redux-little-router v14.3.0
  • flow-bin v0.64.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants