Skip to content

Using configure on string literal causes the enum to become "anyOf" in schema #1470

Closed

Description

@piyushagarwal73

Report a bug

🔎 Search Terms

configure

🧩 Context

  • ArkType version:

  • TypeScript version (5.1+):

  • Other context you think may be relevant (JS flavor, OS, etc.):

    npmPackages:
    @ark/schema: 0.46.0
    @ark/util: 0.46.0
    arktype: 2.1.20
    typescript: 5.8.3

🧑‍💻 Repro

const providerT = type(
"'sqlite' | 'postgresql' | 'mysql' | 'mongodb' | 'cockroachdb'"
);

const DatabaseT = type({
provider: providerT.configure({ title: "Database Provider" }),
url: arktype("string").configure({ title: "Database URL", default: "file:../localdb/sqlite3.db" })

});

If i use providerT.configure({ title: "Database Provider" }), the schema that gets printed has anyOf instead of enum
https://arktype.io/playground?code=import%2520%257B%2520type%2520%257D%2520from%2520%2522arktype%2522%250A%250Aconst%2520Thing%2520%253D%2520type%28%257B%250A%2509provider%253A%2520type%28%250A%2509%2509%2522%27sqlite%27%2520%257C%2520%27postgresql%27%2520%257C%2520%27mysql%27%2520%257C%2520%27mongodb%27%2520%257C%2520%27cockroachdb%27%2522%250A%2509%29.configure%28%257B%2520title%253A%2520%2522Database%2520Provider%2522%2520%257D%29%252C%250A%2509url%253A%2520type%28%2522string%2522%29.configure%28%257B%250A%2509%2509title%253A%2520%2522Database%2520URL%2522%252C%250A%2509%2509default%253A%2520%2522file%253A..%252Flocaldb%252Fsqlite3.db%2522%250A%2509%257D%29%250A%257D%29%250A%250Aconst%2520out%2520%253D%2520Thing%28%257B%250A%2509name%253A%2520%2522TypeScript%2522%252C%250A%2509versions%253A%2520%255B%25225.8.2%2522%252C%25206%252C%25207n%255D%250A%257D%29%250A

if i use provider: providerT, then i get it populated correctly as enum
https://arktype.io/playground?code=import%2520%257B%2520type%2520%257D%2520from%2520%2522arktype%2522%250A%250Aconst%2520Thing%2520%253D%2520type%28%257B%250A%2509provider%253A%2520type%28%250A%2509%2509%2522%27sqlite%27%2520%257C%2520%27postgresql%27%2520%257C%2520%27mysql%27%2520%257C%2520%27mongodb%27%2520%257C%2520%27cockroachdb%27%2522%250A%2509%29%252C%250A%2509url%253A%2520type%28%2522string%2522%29.configure%28%257B%250A%2509%2509title%253A%2520%2522Database%2520URL%2522%252C%250A%2509%2509default%253A%2520%2522file%253A..%252Flocaldb%252Fsqlite3.db%2522%250A%2509%257D%29%250A%257D%29%250A%250Aconst%2520out%2520%253D%2520Thing%28%257B%250A%2509name%253A%2520%2522TypeScript%2522%252C%250A%2509versions%253A%2520%255B%25225.8.2%2522%252C%25206%252C%25207n%255D%250A%257D%29%250A

Activity

  1. added
    bug
    on Jun 18, 2025
  2. prateekMowgli commented on Jun 19, 2025

    @prateekMowgli

    Hi everyone, I am also facing the same issue .. any update ?

  3. added a commit that references this issue on Oct 13, 2026
    f923ffe
  4. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    Member

    Fixed in 3.0.0-beta.0 (#1728). Try it with npm i arktype@next.

  5. 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

Labels

bug

Type

No type

Projects

  • Status
    Done (merged or closed)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions