Re:Why doesn't TypeScript properly type Object.keys?
by Spivak on Saturday June 24, 2023 @11:42AM
(#36459622)
Yes but the Rust example is an ad hoc type rule implemented behind the macro. You can make it type-safe but you lose the ability to have a formatting language in the string itself.
Re:Why doesn't TypeScript properly type Object.keys?
by mirekrusin on Sunday June 25, 2023 @05:13AM
(#36466287)
Rust has explicit support for it in the compiler, which is not great.
Zig does it the right way - it's defined in zig itself, no special cases in compiler like in Rust.
[1]: https://willcrichton.net/notes/type-safe-printf/
[2]: https://hackage.haskell.org/package/formatting