Closed danielweinmann closed 10 months ago
The current runtime logic for no schemas is different for input and environment:
Record<PropertyKey, unknown>
.So the any
on envFoo
above jives with this notion, since descruturing from an unknown
will yield you any
(which should be a red flag on its own).
inputFoo
however, should not have type-checked since it will take only undefined.
What's the reasoning behind assuming Record<PropertyKey, unknown>
for environments?
I just ran some tests and the env is not being considered a record of unknown. Both the input and the env are being inferred as any
.
Ooops. I was on 2.0.0
. On 2.4.0
both are inferred as unknown, which solves the problem 🎉
I would expect the code above to fail to type-check but it works because both input and environment are of type
any
. Is it possible to make themnever
when no schema is passed?I just had an unexpected runtime error because I was destructuring a key from the environment but had forgotten to pass the env schema to
makeDomainFunction
.