Report a bug
π Search Terms
Record, Records, Generics
π§© Context
- ArkType version: 2.1.20
- TypeScript version (5.1+): 5.8.3
- Other context you think may be relevant (JS flavor, OS, etc.):
π§βπ» Repro
In TS I can create needed type as:
type Values = "aaa" | "bbb" | "ccc"
type Thing = Record<Values, number>
const out: Thing = {
aaa: 0,
bbb: 2,
ccc: 4
};
TS Playground
When trying to create the same type in Ark, I get "Index keys "aaa", "bbb", "ccc" should be specified as named props."
import { type } from "arktype"
const values = type.enumerated("aaa", "bbb", "ccc");
const Thing = type.Record(values, "number"); // throws
const out = Thing.assert({
aaa: 0,
bbb: 2,
ccc: 4
})
ArkType Playground