creditkarma / thrift-typescript

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

thrift-typescript doesn't accept maps with the key-value pairs not separated with a comma #170

Open Aurora12 opened 5 years ago

Aurora12 commented 5 years ago

We have a map definition with newlines for delimiters and thrift-typescript doesn't like that.

const map<i32,string> DATA_TYPE = {
    -4: 'Notice'
    -1: 'BackendException'
    1: 'GetConnectionId'
    2: 'ResolveCountry'
    // ...etc
}
Parse Error:
Message: Closing brace missing from map definition
1093 | const map<i32,string> DATA_TYPE = {
                ^

We are using thrift generators for several languages–Scala, Kotlin, Swift, ObjectiveC–and all of them are perfectly fine with newlines instead of commas. So, I presume, this should be the standard behaviour.

This is probably a minor issue, given that it's easily fixed by adding commas, but so you know.

hayes commented 5 years ago

Pretty sure this would be an issue with the parser, which is in a separate repo: https://github.com/creditkarma/thrift-parser