News for hackers. Stuff that matters.
Re:TypeScript please give us types by pas on Friday July 07, 2023 @08:06PM (#36639888)
Maybe I'm very mistaken, but to me it seems this code snippet is basically an alternative to writing a ton of "infer"-s and overloads, no? So the same pattern matching could be used in the "switch". Whatever the complier knows can be locally matched, and the combinations have to be already handled by the developer.
Re:TypeScript please give us types by jitl on Friday July 07, 2023 @09:04PM (#36640279)
It's hard to come up with a compiler that produces a sound checker for arbitrarily complex union/intersection types. Perhaps there could be a restriction on reflection to "simple enough" types, but that's always going to be a weirdly moving target based on heuristics. There's already cases where Typescript tries to generate ~40MB+ .d.ts files which are just re-stating the types themselves. So it's easy to imagine a validator compiler emitting 100MB+ of code to check more wild and crazy types.
Re:TypeScript please give us types by pas on Saturday July 08, 2023 @06:29AM (#36643089)
Size, computation and other budgets seem like useful knobs to expose to developers. And anything that's locally decidable (so can be run on multiple cores easily).