sodiray / radash

Functional utility library - modern, simple, typed, powerful
https://radash-docs.vercel.app
MIT License
4.15k stars 162 forks source link

`isPromise` misleading in type definitions, it should return `value is PromiseLike<>` #418

Open anion155 opened 1 month ago

anion155 commented 1 month ago

isPromise doesn't really checks for value to be instance of Promise class, it checks if value is promise like, so it should return correct typings

It should be

export const isPromise = (value: any): value is PromiseLike<any> => {
aleclarson commented 1 month ago

Hey @anion155. Over at the Radashi fork, this issue is being tracked in https://github.com/orgs/radashi-org/discussions/73. We should have this resolved in the next major version.