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

Is there any ways to use this plugin with Flowtype? #21

Open
FourwingsY opened this issue Sep 4, 2017 · 1 comment
Open

Is there any ways to use this plugin with Flowtype? #21

FourwingsY opened this issue Sep 4, 2017 · 1 comment

Comments

@FourwingsY
Copy link

FourwingsY commented Sep 4, 2017

type Test = Map<string, any>

const test: Test = Immutable.Map({...})
const { a, b, c } = test

property 'a'. Property not found on Map.

type Test = {
  a: number,
  b: number,
  c: string,
}

const test: Test = Immutable.Map({...})
const a = test.get('a')

Flow: property 'get'. Property not found in object type

type Test = {
  get: Function,
  set: Function,
  a: number,
  b: number,
  c: string,
}
const test: Test = Immutable.Map({...})
const a = test.get('a')
const { b, c } = test

this is OK but bit strange for use. if i use getIn or merge, I have to define that function also.

@FourwingsY
Copy link
Author

FourwingsY commented Sep 6, 2017

I found some tricky ways to solve this

type Test = Map<string, any> & {
    a?: number,
    b?: number,
    c?: string,
}

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

No branches or pull requests

1 participant