seasonedcc / composable-functions

Types and functions to make composition easy and safe
MIT License
649 stars 13 forks source link

TS won't complain about implicit any in composable declaration #146

Closed danielweinmann closed 3 months ago

danielweinmann commented 3 months ago

Example:

image

gustavoguichard commented 3 months ago

I don't get this bug, isn't it what TS does by default?

Screenshot 2024-06-05 at 13 01 57

What are we aiming for here? IMO you should type your parameters as you do with any function, but wrapping it in a composable will give ou composability and monadic error handling. When using withSchema on the other hand, the parameters will infer the type of the schema given earlier and if none is given then the parameters will be unknown.

danielweinmann commented 3 months ago

I want to have the same error I get when using strict TS inside of composable. Here's an example:

const foo = (bar) => bar
// ^ Error TS7006: Parameter bar implicitly has an any type.

const foo2 = composable((bar) => bar)
// ^ No error whatsoever
gustavoguichard commented 3 months ago

Fair enough... so the problem is not that it is any but the fact the lint isn't complaining, right? I'll try to replicate to see what I can do about it

diogob commented 3 months ago

@gustavoguichard to be more precise, that is a TS error (no linting required).