Flow-bin: Flow 0.57.3 zeigt keine Fehler

Erstellt am 24. Okt. 2017  ·  3Kommentare  ·  Quelle: flowtype/flow-bin

Ich habe Flow 0.57.3 in verschiedenen Projekten 0.56.0 verwendet
Ich habe absichtlich ein paar Fehler gemacht, die die alte Version richtig anzeigte.
Auf 0.57.3 sagt Flow jedoch _No Errors_.

Mache ich etwas falsch oder funktioniert die aktuelle Version nicht?

Als Randnotiz:
Nach der offiziellen Dokumentation, die ich verwende
eine disjunkte Union für Redux-Aktionen. Ich habe erwartet, dass Flow einen Fehler auslöst, wenn ich nichts anbiete
Fällen für jede Aktion in meinem Reduzierer, aber der Fluss scheint damit irgendwie in Ordnung zu sein.

// 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
  }
}

Hilfreichster Kommentar

Alle 3 Kommentare

Vielleicht im Zusammenhang mit https://github.com/facebook/flow/issues/5105

scheint ein Flow-Problem zu sein, kein Flow-Bin-Problem.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen

Verwandte Themen

g-bastianelli picture g-bastianelli  ·  4Kommentare

villesau picture villesau  ·  3Kommentare

pss2125 picture pss2125  ·  24Kommentare

arefaslani picture arefaslani  ·  13Kommentare

bxt picture bxt  ·  7Kommentare