Re:I’m porting the TypeScript type checker tsc to Go
by rslabbert on Tuesday January 25, 2022 @07:23PM
(#30080078)
I haven't found any large scale analyses but here's an example of a simple type annotation halving compilation time: https://stackoverflow.com/questions/36624273/investigating-l...
The Typescript compiler performance wiki might also be of interest: https://github.com/microsoft/TypeScript/wiki/Performance
Re:I’m porting the TypeScript type checker tsc to Go
by travisd on Tuesday January 25, 2022 @04:23PM
(#30078256)
I haven’t personally benchmarked it, but I know it’s available as an eslint rule (all exported functions must have declared return types).
Re:I’m porting the TypeScript type checker tsc to Go
by Smaug123 on Tuesday January 25, 2022 @06:50PM
(#30079813)
This makes sense for semantic reasons though. If you accidentally return a `number` when you returned a `string` in some earlier branch, Typescript will happily unify them and now your function silently returns `string | number`. The linting rule prevents this.
I hadn't heard of this trick - how much improvement does it make? Seems like it might be good for readability, too?