arktype icon indicating copy to clipboard operation
arktype copied to clipboard

ArkRegex's `regex()` returns `any` type in the playground

Open roottool opened this issue 3 months ago • 0 comments

Report a bug

Using ArkRegex's regex() in the Playground results in type inference being any, which is different from what is shown in the demo video of "Introducing ArkRegex".

Expected behavior

The results of type inference will be the same for both of the demo and the playground.

🔎 Search Terms

  • ArkRegex
  • regex
  • Playground

🧩 Context

  • Other context you think may be relevant (JS flavor, OS, etc.): The playground at the time this issue was created.

🧑‍💻 Repro

Playground Link: Here

The code for reproduction is the sample code in the blog post "Introducing ArkRegex".

import { regex } from "arkregex"

const ok = regex("^ok$", "i")
// Regex<"ok" | "oK" | "Ok" | "OK", { flags: "i" }>

const semver = regex("^(\\d*)\\.(\\d*)\\.(\\d*)$")
// Regex<`${bigint}.${bigint}.${bigint}`, { captures: [`${bigint}`, `${bigint}`, `${bigint}`] }>

const email = regex("^(?<name>\\w+)@(?<domain>\\w+\\.\\w+)$")
// Regex<`${string}@${string}.${string}`, { names: { name: string; domain: `${string}.${string}`; }; ...>

I don't know if it's related, but a reference error Define a Type called "Thing" to enable introspection. was displayed.

Screenshots Image Image

roottool avatar Nov 01 '25 13:11 roottool