creditkarma / thrift-typescript

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

fix: Correctly handle annotations that are not valid identifiers #134

Closed hayes closed 5 years ago

hayes commented 5 years ago

Currently annotation that are not valid javascript identifiers will render as invalid typescript when compiled for thrift-server. This adds a simple check on the annotation name, and if it contains special characters that are not valid in a js identifier, it wraps the identifier in a string. JS objects support any string as a key, so this should be 100% compatible with the way annotations are currently handled.