creditkarma / thrift-typescript

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

fix: default values for unions should only be used when no fields are set #163

Closed kevin-greene-ck closed 5 years ago

kevin-greene-ck commented 5 years ago

Resolves #162

Fixes an issue where defined defaults in unions could result in multiple fields being set.

kevin-greene-ck commented 5 years ago

@hayes This is what I came up with. Look okay to you? Test fixture for this: https://github.com/creditkarma/thrift-typescript/pull/163/files#diff-8b97c3b8f61620cfd5530231d88df535

hayes commented 5 years ago

looks good to me!

testing it out now on our code base.

hayes commented 5 years ago

confirmed that this works with all our schemas! thanks for getting this together so quickly.

kevin-greene-ck commented 5 years ago

Cool, I'll publish in a few minutes.

kevin-greene-ck commented 5 years ago

Released in 3.7.1