-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Possible? Capture and return modified signature #10215
Labels
Question
An issue which isn't directly actionable in code
Comments
Would #5453 solve this? |
For any given number of parameters it is possible and easy: declare function promisify<T, R>(fn: (arg: T) => R): (arg: T) => Promise<R>;
declare function promisify<T1, T2, R>(fn: (arg1: T1, arg2: T2) => R): (arg1: T1, arg2: T2) => Promise<R>; However the most general declaration would require #5453 (@yortus thanks, was looking for it when you replied). |
BTW, I wanted to file suggestion/proposal for way more complicated scenarios like that: declare function f<T>(arg: T): [T];
const pf = promisify(f); // it won't infer <T>(arg: T) => Promise<T> -- which is sad |
Thanks. I'll check it out |
RyanCavanaugh
added
the
Question
An issue which isn't directly actionable in code
label
Aug 15, 2016
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
TypeScript: 2.0.0
AFAIK it is currently not possible, thus we need to do something like this:
https://github.com/types/npm-bluebird/blob/master/bluebird.d.ts#L333
Is it possible in the future, or it's just a hard limitation that it can't be done?
The text was updated successfully, but these errors were encountered: