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
}
}
Vielleicht im Zusammenhang mit https://github.com/facebook/flow/issues/5105
@on3iro siehe https://github.com/facebook/flow/issues/5180
scheint ein Flow-Problem zu sein, kein Flow-Bin-Problem.
Hilfreichster Kommentar
@on3iro siehe https://github.com/facebook/flow/issues/5180