Using configure on string literal causes the enum to become "anyOf" in schema
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
Hi everyone, I am also facing the same issue .. any update ?