creditkarma / thrift-typescript

Generate TypeScript from Thrift IDL files
Apache License 2.0
155 stars 32 forks source link

Add explicit type to temporary object when encoding structs and unions #164

Closed hayes closed 5 years ago

hayes commented 5 years ago

There is a type error that occurs in the encode method for structs and unions with an empty map initializer. The temporary object sees the default map as Map<unknown, unknown>.

before:

Screen Shot 2019-07-01 at 1 28 39 PM

after:

Screen Shot 2019-07-01 at 2 05 55 PM

I think this may only be an issue with specific flags or typescript versions, but adding the explicit type avoids any issues.