Open FourwingsY opened 7 years ago
type Test = Map<string, any>
const test: Test = Immutable.Map({...}) const { a, b, c } = test
`property 'a'. Property not found on Map.` 2.
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` 3.
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, }
const test: Test = Immutable.Map({...}) const { a, b, c } = test
type Test = { a: number, b: number, c: string, }
const test: Test = Immutable.Map({...}) const a = test.get('a')
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