arktypea
arktypeโ€ข14mo ago
Bobakanoosh

Using scope with morphs

I store some data in a json file, so I'm using string.json.parse to read that data in and validate it.
const UserConfigSchema = scope({
    config: type("string.json.parse").to({
                // ERROR:
                // "windowMeta" is unresolvable
        windowMeta: "Record<string, windowMeta>",
    }),
    windowMeta: {
        "position?": {
            x: "number",
            y: "number",
        },
    },
}).export();


Maybe I shouldn't be using scope here and should instead be directly using the windowMeta type within the Record?
Was this page helpful?