Loading video...

Video Failed to Load

Go Home

📢Introducing ArkRegex📢 a drop in replacement for new RegExp() with types ⬇️

733,454 views • 11 months ago •via X (Twitter)

45 Comments

ArkType's profile picture
ArkType11 months ago

arkregex is a standalone, type-only package that adds types to RegExp. if you prefer... 🔎 clarity over opacity 🔒 safety over crashing using it should be the easiest win of your life. announcement:

colinhacks's profile picture
colinhacks11 months ago

david if you keep going down this path I won't be able to help you

phong's profile picture
phong11 months ago

we devs were so preoccupied with whether we could, that we didn't stop to think if we should this is amazing though

ArkType's profile picture
ArkType11 months ago

we thought about it and concluded that if you haven't already installed arkregex your project is garbage

Rhys's profile picture
Rhys11 months ago

This is insane

Maurice Kleine's profile picture
Maurice Kleine11 months ago

there's Doom in Typescript, and juuuuuust below that is ArkRegex

kenneth's profile picture
kenneth11 months ago

typesafe eval() wen?

Salman Shaikh's profile picture
Salman Shaikh11 months ago

how is this even possible in typescript?

ArkType's profile picture
ArkType11 months ago

unironically same strategy used to run DOOM (but highly optimized)

Salman Shaikh's profile picture
Salman Shaikh11 months ago

wait! you can run DOOM in ts?

Salman Shaikh's profile picture
Salman Shaikh11 months ago

cool!

Aman's profile picture
Aman11 months ago

Plz stop kidding 🙏

Ray's profile picture
Ray11 months ago

🔮 and thank you!

ArkType's profile picture
ArkType11 months ago

readable regex for the masses✊

Maximilian's profile picture
Maximilian11 months ago

can I safely use this and not have my lsp blow up?

ArkType's profile picture
ArkType11 months ago

Generally, yes. A lot of effort went into optimizing the parser including dozens of type-level benchmarks. Of course eventually you'll hit the limits of TypeScript eventually with enough unions but it's pretty easy to just not use it for those extreme cases.

ArkType's profile picture
ArkType11 months ago

There's a fallback for declaring the type or you can just use `new RegExp()` for those cases.

Maximilian's profile picture
Maximilian11 months ago

just for reference how many instantiations would a regular type be or a zod object - and at what number does the lsp start falling apart? I understand that these numbers are probably sensible for you (and I understand lower = better) but it’s like a currency I never used very grateful if you feel like you have the energy to explain but totally understandable if not Library is pure magic no matter what but lsp performance has burnt me completely

ArkType's profile picture
ArkType11 months ago

Most of these cases are less expensive than a simple zod schema. 1-10k instantiations is pretty standard for that sort of thing.

ArkType's profile picture
ArkType11 months ago

You just have to be careful if your expression is combinatorial, but there's a ceiling on what TS will do before complaining anyways. A good heuristic would be to look at the number of branches in the union of the result type. If you see >10k, you may want to declare the type

Sameer's profile picture
Sameer11 months ago

how?? how?? you're making things typesafe, which I never even thought of could be possible?

Matt Popovich's profile picture
Matt Popovich11 months ago

holy shit this is amazing

Steve Ruiz's profile picture
Steve Ruiz11 months ago

jesus

Arian's profile picture
Arian11 months ago

This is black magic. Crazy work.

Shounak Ghosh's profile picture
Shounak Ghosh11 months ago

typesafe regex is craazy (⁠・⁠o⁠・⁠;⁠)

dev's profile picture
dev11 months ago

this is insane, what's next on the horizon ?

ArkType's profile picture
ArkType11 months ago

type-level AGI

ArkType's profile picture
ArkType11 months ago

(actually though [email protected] which will integrate this syntax natively)

Seb's profile picture
Seb11 months ago

I'm about to switch from a python stack to a Typescript one. I can't wait to use this!

ArkType's profile picture
ArkType11 months ago

love it, proving my point here👍

vinay's profile picture
vinay11 months ago

insanee

tanpreet 🌂's profile picture
tanpreet 🌂11 months ago

woah 😮

Jasper 張 🟠's profile picture
Jasper 張 🟠11 months ago

This is so good and useful

Hamza Mateen's profile picture
Hamza Mateen11 months ago

rust port?

Wahyu's profile picture
Wahyu11 months ago

holy shit, i feel like TypeScript template literal types need to file a restraining order against you

Odii's profile picture
Odii11 months ago

cracked shit.

Pooria Faramarzian's profile picture
Pooria Faramarzian11 months ago

@amosavian

Georges Haidar's profile picture
Georges Haidar11 months ago

Oh my days… @ssalbdivad you crazy scientist.

Beardo Schmidt 🦗's profile picture
Beardo Schmidt 🦗11 months ago

Whoa. Didn’t expect this to come standalone!! Sold

harsh's profile picture
harsh11 months ago

Really cool stuff.

boidu's profile picture
boidu11 months ago

Nah this is crazy wth..

Liam Monaghan's profile picture
Liam Monaghan11 months ago

actual wizardry

Nikoemme's profile picture
Nikoemme11 months ago

god this is a banger ! congrats

Savvas Papageorgiadis's profile picture
Savvas Papageorgiadis11 months ago

HUH?

Yash Kandalkar's profile picture
Yash Kandalkar11 months ago

Amazing!

Related Videos