Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
danielweinmann opened this issue Jun 5, 2024 · 4 comments
Closed
Labels
🐛 bug Something isn't working

Comments

@danielweinmann
Copy link
Contributor

Example:

image

@danielweinmann danielweinmann added the 🐛 bug Something isn't working label Jun 5, 2024
@gustavoguichard
Copy link
Collaborator

gustavoguichard commented Jun 5, 2024

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
Copy link
Contributor Author

danielweinmann commented Jun 5, 2024

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
Copy link
Collaborator

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
Copy link
Contributor

diogob commented Jun 5, 2024

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

@gustavoguichard gustavoguichard changed the title Composable arguments are of type any unless I explicitly declare their types TS won't complain about implicit any in composable declaration Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants