Hacker News new | ask | show | jobs
by ssalbdivad 1195 days ago
Massive release! `const` generic parameters in particular have been a god-send for our repo’s static inference (https://github.com/arktypeio/arktype) where previously we were forced to constantly rely on complex narrowing logic based on extends checks.

I look forward to the day when we support 5.0 as our minimum version and replace all of them with `const` generics for 1:1-inferred definitions like this:

const package = type({ name: "string", "version?": "number" })

Plus we’ll finally be able to remove the crazy hack we had to write to allow ts-morph to make type assertions on our codebase by transforming all of our `.ts` imports to `.js` in a virtual file system, which now that I think of it I’m probably looking forward to deleting even more XD

Great work, and looking forward to what comes next!

1 comments

100%! I have a package that I've been running on nightly just to get this.

Felt a bit like the wait for a const generics in Rust (except here, it didn't take long at all)!