Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow 0.57.3 shows no errors #91

Closed
on3iro opened this issue Oct 24, 2017 · 3 comments · May be fixed by facebook/flow#5850
Closed

Flow 0.57.3 shows no errors #91

on3iro opened this issue Oct 24, 2017 · 3 comments · May be fixed by facebook/flow#5850

Comments

@on3iro
Copy link

on3iro commented Oct 24, 2017

I tried flow 0.57.3 inside various projects where I used 0.56.0 before.
I made a few errors on purpose, which the old version showed correctly.
On 0.57.3 however flow says No Errors.

Am I doing something wrong or does the current version not work?

On a side-note:
Following the offical documentation I am using
a disjoint Union for redux actions. I was expecting flow to throw an error if I do not provide
cases for every action in my reducer, but flow somehow seems to be fine with that.

// types
const INIT = 'INIT'
const USER_FETCH_SUCCESS = 'USER_FETCH_SUCCESS'
const USER_FETCH_FAIL = 'USER_FETCH_FAIL'

type User = {
  +id: string,
  +name: string,
  +age: number
}

type Init = {| type: typeof INIT |}
type UserFetchSuccess = {| type: typeof USER_FETCH_SUCCESS, payload: User |}
type UserFetchFail = {| type: typeof USER_FETCH_FAIL, payload: Object |}

type Action = Init | UserFetchSuccess | UserFetchFail

// Reducer
const fakeUserReducer = (state: State = {
  loading: false,
  user: null,
  error: null
}, action: Action): State => {
  switch (action.type) {
    case INIT:
      return loop(
        {...state, loading: true},
        Cmd.run(fetchUser, {
          successActionCreator: userFetchSuccessfulAction,
          failActionCreator: userFetchFailedAction,
          args: ['userA']
        })
      )

    case USER_FETCH_SUCCESS:
      return { ...state, user: action.payload, loading: false }

     // Flow wont throw an error, even if this case is missing
    // case USER_FETCH_FAIL:
      // return { ...state, error: action.payload, loading: false }

    default:
      return state
  }
}
@apsavin
Copy link

apsavin commented Oct 24, 2017

Maybe related to facebook/flow#5105

@apsavin
Copy link

apsavin commented Nov 4, 2017

@on3iro see facebook/flow#5180

@mroch
Copy link
Contributor

mroch commented Aug 11, 2019

seems to be a flow issue, not a flow-bin issue.

@mroch mroch closed this as completed Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants