vacuumlabs/babel-plugin-extensible-destructuring

Is there any ways to use this plugin with Flowtype?

FourwingsY opened this issue · 1 comments

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.

I found some tricky ways to solve this

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