When a Field is constructed from a parametrized type, it can't correctly infer the underlying type without an explicit annotation. This is trivial to add, but irritating boilerplate.
const person = Record("person", {
name: Field(String()),
age: Field(Long()),
});
const field = Field(person) // infers RequiredField<unknown>
const betterField = Field<typeof person>(person) //infers RequiredField<{name: string, age: number}>
Ideally fields would automatically do this inference, rather than needing to be "prompted" in this way. This feels like a higher kinded types problem though, so I'm not sure if there is a solution.
The issue exists for any field constructed with an underlying type which has a parameter.
When a Field is constructed from a parametrized type, it can't correctly infer the underlying type without an explicit annotation. This is trivial to add, but irritating boilerplate.
Ideally fields would automatically do this inference, rather than needing to be "prompted" in this way. This feels like a higher kinded types problem though, so I'm not sure if there is a solution.
The issue exists for any field constructed with an underlying type which has a parameter.