sindresorhus / p-memoize

Memoize promise-returning & async functions
MIT License
396 stars 30 forks source link

.clear types are not correct #16

Closed moltar closed 4 years ago

moltar commented 4 years ago
const getClient = pMemoize(function getClient(id: number) {
  return client.getClient(id)
})

//           > error here <
pMemoize.clear(getClient)
Argument of type '(id: number) => Promise<Client>' is not assignable to parameter of type '(...arguments: unknown[]) => unknown'.
  Types of parameters 'id' and 'arguments' are incompatible.
    Type 'unknown' is not assignable to type 'number'.

Thanks

sindresorhus commented 4 years ago

Does it work if you change (...arguments: unknown[]) to (...arguments: any[])?

moltar commented 4 years ago

Yup, it does! :) And that was the quickest reply I've ever had on GH, I think 😁

moltar commented 4 years ago

Shaa-weet. Thank you 🙏