Closed object88 closed 7 years ago
Given...
export type FooModelType = { barAry: Array<BarModelType>, };
Original code was generating...
static fromJS(json: $Diff<FooModelType, typeof defaultFooValues>): Foo { // [...] state.barAry = state.barAry.map(item => item.fromJS(item)); // [...] }
When invoking Foo.fromJS and passing in { barAry: [{...}] }, code would throw error, item.fromJS is not a function.
Foo.fromJS
{ barAry: [{...}] }
item.fromJS is not a function
New code correctly(?) generates...
static fromJS(json: $Diff<FooModelType, typeof defaultFooValues>): Foo { // [...] state.barAry = state.barAry.map(item => Bar.fromJS(item)); // [...] }
LGTM. I'll add a test for the Array<*ModelType> case.
Array<*ModelType>
Given...
Original code was generating...
When invoking
Foo.fromJS
and passing in{ barAry: [{...}] }
, code would throw error,item.fromJS is not a function
.New code correctly(?) generates...