Skip to content

@ark/fast-check generates strings that fail the type when the regex has the u flagΒ #1720

Description

@RaphaelFakhri

πŸ”Ž Search Terms

fast-check, arkToArbitrary, regex flags, unicode, u flag

🧩 Context

  • ArkType version: main (2.2.9)
  • TypeScript version (5.1+): 7.1.0-beta
  • @ark/fast-check: main
  • fast-check: 3.23.2

πŸ§‘β€πŸ’» Repro

import { type } from "arktype"
import { arkToArbitrary } from "@ark/fast-check"
import * as fc from "fast-check"

const T = type(/^\u{1F600}[a-z]$/u)
const samples = fc.sample(arkToArbitrary(T), 5)
// ["u{1F600}a", "u{1F600}k", ...]
samples.every(s => T.allows(s)) // false

buildStringArbitrary rebuilds the pattern with new RegExp(pattern), so the regex flags are lost. Without u, \u{1F600} matches the literal text u{1F600}, so every generated value fails T. A character-class range that needs u, such as /^[πŸ˜€-πŸ˜‚]$/u, throws SyntaxError: Range out of order instead.

Expected: generated strings satisfy the type, or arkToArbitrary throws if fast-check can't support the pattern.

Activity

  1. added 2 commits that reference this issue on Nov 9, 2026
    a4be43a
    a8f468f
  2. moved this from To do to Done (merged or closed) in arktypeioon Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done (merged or closed)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions