seasonedcc/composable-functions

Should Input types be Inferred from the Input Schema?

stephen776 opened this issue · 4 comments

I have the following example and I am wondering if I should be seeing the input to increment being inferred? Currently the type is reported as unknown. This seems like a shortcoming if I can't see the type at dev time.

image

Hey, @stephen776!

Having the input and environment be unknown is desirable when using external sources like API responses or FormData. Everything else is type-safe, but we assume we cannot control the input or environment types. That's how zod works as well, and it solves the majority of use cases.

But @diogob is trying to implement strict inputs and environments in #69. With that, we can make our DFs strict whenever we know the input/environment types and flexible when we don't. We don't have an estimate of when this will be ready, but we know it will be a v2 thing :)

Thanks for the response. Totally makes sense in the context of input from form data and such. Looking forward to seeing what you all have in store for v2

@stephen776 , I'm gonna close this issue for now. I added a little FAQ in the README to answer questions like that and we will let you know whenever we come up with a solution ;)
Thank you for the feedback!

Hey @stephen776 just pinging you as the v4 of this lib - which is now called composable-functions - does what you wanted it to do ;)

Check out the README and let us know how it goes!