Manweill / swagger-axios-codegen

swagger client to use axios and typescript
MIT License
306 stars 83 forks source link

Fixes type error on data declaration #4

Closed kt81 closed 6 years ago

kt81 commented 6 years ago

In generated request function,

//...
let data = null;
data = { ...params['prop'] }
//...

Even though the data object is declared as null type, it is reassigned the value that has actual type. I don't know if it is ok on other environments but my ts3.0 project got some errors.

Manweill commented 6 years ago

Hey! @kt81 I check codegen in ts3.0.3, it is ok . example

can you describe the details? although your commits is also feasible

kt81 commented 6 years ago

Hi, @Manweill. Thank you for merge.

I realized that this error appearing or not depends on the strictNullChecks compiler option. If this option is true, the compiler reports TS2322 error.