alexreardon / memoize-one

A memoization library which only remembers the latest invocation
MIT License
2.94k stars 78 forks source link

Don't allow `resultFn` to resolve to implicit any params #186

Closed oriSomething closed 11 months ago

oriSomething commented 2 years ago

I saw this trick in React 18 types: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56210/files#diff-32cfd8cb197872bcba371f5018185d2e75fa540b52cda2dd7d8ac12dcc021299R1068 And the discussion https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435

I think we should ban implicit any as well. The only issue is that it might be a breaking change, But I don't think so, from looking at memoize-one definitions. It might only force some users to add types or explicit any.

oriSomething commented 2 years ago

So it seems, we can't do the same conversion 😑 because Parameters and ReturnType don't work with Function. The other question is should we at least replace any with unknown to provide a bit stricter detentions

oriSomething commented 2 years ago

It seems also unknown has some issues, I wonder if there is any TS wizard that can solve this issue, if it's possible

alexreardon commented 11 months ago

Is this still an issue?

oriSomething commented 7 months ago

It's still an issue, but I don't think it's fixable anyway