Open ssalbdivad opened 1 year ago
A more recent example from #1034:
import { scope, type } from "arktype";
const t = type([{ a: "number" }, "=>", (obj) => ({ ...obj, b: obj.a + 3 })]); // fine (is typed correctly)
// ^?
const Event = scope({ Event: [{ a: "number" }, "=>", (obj) => ({ ...obj, b: obj.a + 3 })] }).export().Event // not fine (is typed as `never` -- NB: works as-expected at runtime)
// ^?
There is a problem inferring tuple expressions that reference an object in a scope. Based on some investigation, it has to do with aliases being passed to validateDefinition and an object type being parsed as the input definition.
Can be reproed with this test: