redux-form / redux-form

A Higher Order Component using react-redux to keep form state in a Redux store
https://redux-form.com
MIT License
12.58k stars 1.64k forks source link

flow errors with 7.0.3 #3444

Open dagda1 opened 7 years ago

dagda1 commented 7 years ago

When I run yarn flow on 7.0.3, for the following line of code:

`dispatch(initialize(formName, values));`

I get this error:

157:       dispatch(initialize(formName, values));
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function call. Function cannot be called on any member of intersection type
157:       dispatch(initialize(formName, values));
                    ^^^^^^^^^^ intersection
  Member 1:
                                      v
  144: export type InitializeAction = {
  145:   type: string,
  146:   meta: { form: string, keepDirty: boolean },
  147:   payload: Object
  148: } & Action
       ^ object type. See: node_modules/redux-form/lib/actions.types.js.flow:144

Looking at the type definition in redux-form, I see:

export type InitializeAction = {
  type: string,
  meta: { form: string, keepDirty: boolean },
  payload: Object
} & Action
export type Initialize = {
  (
    form: string,
    values: Object,
    keepDirty: boolean,
    otherMeta: Object
  ): InitializeAction
}

So My initialize looks correct, I do not understand why I am seeing these errors

gustavohenke commented 7 years ago

Can you please try v7.0.4? It has some updates for Flow. I still don't fully grasp it, so I can't tell if it's going to fix your issue 😕

dagda1 commented 7 years ago

The problem with 7.0.4 is that uses new React type definitions

dagda1 commented 7 years ago

where is redux-form getting its react type definitions from? Which version of react

dagda1 commented 7 years ago

with 7.0.4 we get these errors:

100: declare export var Field: React.ComponentType<FieldInputProps>
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ComponentType. Property not found in
  2: import * as React from 'react'
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exports of "react"

With React 15.6.1 anyway

gustavohenke commented 6 years ago

Hi @dagda1, do you still see these errors with newer versions of redux-form? You may want to check the changelogs for v7.1.0 and v7.1.1 as well.

dagda1 commented 6 years ago

7.0.3 to 7.0.4 had a major react version increase which was surprising

On Mon, 16 Oct 2017 at 03:29, Gustavo Henke notifications@github.com wrote:

Hi @dagda1 https://github.com/dagda1, do you still see these errors with newer versions of redux-form? You may want to check the changelogs for v7.1.0 https://github.com/erikras/redux-form/releases/tag/v7.1.0 and v7.1.1 https://github.com/erikras/redux-form/releases/tag/v7.1.1 as well.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/erikras/redux-form/issues/3444#issuecomment-336764373, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHOOFC7r_yokM0n8DyhVxGZyCyhE9cyks5ssr-BgaJpZM4Pf86E .

-- Cheers

Paul Cowan

Cutting-Edge Solutions (Scotland)

blog: http://thesoftwaresimpleton.com/ website: http://www.cuttingedgesolutionsscotland.com/

ericstumper commented 6 years ago

@dagda1 did you find a way to use newer versions of redux-form than 7.0.3 with React 15? Or do I have to update React to use the current flow types? React 15 is still listed in peer dependencies.

dagda1 commented 6 years ago

@ericstumper I've moved to typescript. I found flow unusable, maybe I'm missing something but I found it was really slow and buggy.