正在加载视频...

视频加载失败

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

733,454 次观看 • 11 个月前 •via X (Twitter)

45 条评论

ArkType 的头像
ArkType11 个月前

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 的头像
colinhacks11 个月前

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

phong 的头像
phong11 个月前

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

ArkType 的头像
ArkType11 个月前

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

Rhys 的头像
Rhys11 个月前

This is insane

Maurice Kleine 的头像
Maurice Kleine11 个月前

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

kenneth 的头像
kenneth11 个月前

typesafe eval() wen?

Salman Shaikh 的头像
Salman Shaikh11 个月前

how is this even possible in typescript?

ArkType 的头像
ArkType11 个月前

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

Salman Shaikh 的头像
Salman Shaikh11 个月前

wait! you can run DOOM in ts?

Salman Shaikh 的头像
Salman Shaikh11 个月前

cool!

Aman 的头像
Aman11 个月前

Plz stop kidding 🙏

Ray 的头像
Ray11 个月前

🔮 and thank you!

ArkType 的头像
ArkType11 个月前

readable regex for the masses✊

Maximilian 的头像
Maximilian11 个月前

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

ArkType 的头像
ArkType11 个月前

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 的头像
ArkType11 个月前

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

Maximilian 的头像
Maximilian11 个月前

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 的头像
ArkType11 个月前

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

ArkType 的头像
ArkType11 个月前

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 的头像
Sameer11 个月前

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

Matt Popovich 的头像
Matt Popovich11 个月前

holy shit this is amazing

Steve Ruiz 的头像
Steve Ruiz11 个月前

jesus

Arian 的头像
Arian11 个月前

This is black magic. Crazy work.

Shounak Ghosh 的头像
Shounak Ghosh11 个月前

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

dev 的头像
dev11 个月前

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

ArkType 的头像
ArkType11 个月前

type-level AGI

ArkType 的头像
ArkType11 个月前

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

Seb 的头像
Seb11 个月前

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

ArkType 的头像
ArkType11 个月前

love it, proving my point here👍

vinay 的头像
vinay11 个月前

insanee

tanpreet 🌂 的头像
tanpreet 🌂11 个月前

woah 😮

Jasper 張 🟠 的头像
Jasper 張 🟠11 个月前

This is so good and useful

Hamza Mateen 的头像
Hamza Mateen11 个月前

rust port?

Wahyu 的头像
Wahyu11 个月前

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

Odii 的头像
Odii11 个月前

cracked shit.

Pooria Faramarzian 的头像
Pooria Faramarzian11 个月前

@amosavian

Georges Haidar 的头像
Georges Haidar11 个月前

Oh my days… @ssalbdivad you crazy scientist.

Beardo Schmidt 🦗 的头像
Beardo Schmidt 🦗11 个月前

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

harsh 的头像
harsh11 个月前

Really cool stuff.

boidu 的头像
boidu11 个月前

Nah this is crazy wth..

Liam Monaghan 的头像
Liam Monaghan11 个月前

actual wizardry

Nikoemme 的头像
Nikoemme11 个月前

god this is a banger ! congrats

Savvas Papageorgiadis 的头像
Savvas Papageorgiadis11 个月前

HUH?

Yash Kandalkar 的头像
Yash Kandalkar11 个月前

Amazing!

相关视频