Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

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

733,454 Aufrufe • vor 11 Monaten •via X (Twitter)

45 Kommentare

Profilbild von ArkType
ArkTypevor 11 Monaten

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:

Profilbild von colinhacks
colinhacksvor 11 Monaten

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

Profilbild von phong
phongvor 11 Monaten

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

Profilbild von ArkType
ArkTypevor 11 Monaten

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

Profilbild von Rhys
Rhysvor 11 Monaten

This is insane

Profilbild von Maurice Kleine
Maurice Kleinevor 11 Monaten

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

Profilbild von kenneth
kennethvor 11 Monaten

typesafe eval() wen?

Profilbild von Salman Shaikh
Salman Shaikhvor 11 Monaten

how is this even possible in typescript?

Profilbild von ArkType
ArkTypevor 11 Monaten

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

Profilbild von Salman Shaikh
Salman Shaikhvor 11 Monaten

wait! you can run DOOM in ts?

Profilbild von Salman Shaikh
Salman Shaikhvor 11 Monaten

cool!

Profilbild von Aman
Amanvor 11 Monaten

Plz stop kidding 🙏

Profilbild von Ray
Rayvor 11 Monaten

🔮 and thank you!

Profilbild von ArkType
ArkTypevor 11 Monaten

readable regex for the masses✊

Profilbild von Maximilian
Maximilianvor 11 Monaten

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

Profilbild von ArkType
ArkTypevor 11 Monaten

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.

Profilbild von ArkType
ArkTypevor 11 Monaten

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

Profilbild von Maximilian
Maximilianvor 11 Monaten

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

Profilbild von ArkType
ArkTypevor 11 Monaten

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

Profilbild von ArkType
ArkTypevor 11 Monaten

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

Profilbild von Sameer
Sameervor 11 Monaten

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

Profilbild von Matt Popovich
Matt Popovichvor 11 Monaten

holy shit this is amazing

Profilbild von Steve Ruiz
Steve Ruizvor 11 Monaten

jesus

Profilbild von Arian
Arianvor 11 Monaten

This is black magic. Crazy work.

Profilbild von Shounak Ghosh
Shounak Ghoshvor 11 Monaten

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

Profilbild von dev
devvor 11 Monaten

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

Profilbild von ArkType
ArkTypevor 11 Monaten

type-level AGI

Profilbild von ArkType
ArkTypevor 11 Monaten

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

Profilbild von Seb
Sebvor 11 Monaten

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

Profilbild von ArkType
ArkTypevor 11 Monaten

love it, proving my point here👍

Profilbild von vinay
vinayvor 11 Monaten

insanee

Profilbild von tanpreet 🌂
tanpreet 🌂vor 11 Monaten

woah 😮

Profilbild von Jasper 張 🟠
Jasper 張 🟠vor 11 Monaten

This is so good and useful

Profilbild von Hamza Mateen
Hamza Mateenvor 11 Monaten

rust port?

Profilbild von Wahyu
Wahyuvor 11 Monaten

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

Profilbild von Odii
Odiivor 11 Monaten

cracked shit.

Profilbild von Pooria Faramarzian
Pooria Faramarzianvor 11 Monaten

@amosavian

Profilbild von Georges Haidar
Georges Haidarvor 11 Monaten

Oh my days… @ssalbdivad you crazy scientist.

Profilbild von Beardo Schmidt 🦗
Beardo Schmidt 🦗vor 11 Monaten

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

Profilbild von harsh
harshvor 11 Monaten

Really cool stuff.

Profilbild von boidu
boiduvor 11 Monaten

Nah this is crazy wth..

Profilbild von Liam Monaghan
Liam Monaghanvor 11 Monaten

actual wizardry

Profilbild von Nikoemme
Nikoemmevor 11 Monaten

god this is a banger ! congrats

Profilbild von Savvas Papageorgiadis
Savvas Papageorgiadisvor 11 Monaten

HUH?

Profilbild von Yash Kandalkar
Yash Kandalkarvor 11 Monaten

Amazing!

Ähnliche Videos