logoalt Hacker News

shakowyesterday at 8:06 AM1 replyview on HN

Not really familiar with TS, but what would be so weird with the typing? Wouldn't it be generic over `T -> U`, with T the type with snake_case fields and U the type with pascalCase fields?


Replies

cyborgsquirrelyesterday at 8:28 AM

Turns out in TypeScript you can model the conversion of the keys themselves from snake_case to pascalCase within the type system[0]. I assume they meant that this was the difficult part.

[0]: https://stackoverflow.com/questions/60269936/typescript-conv...