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

Automatically get types from memoized function #46

Closed
fregante opened this issue May 21, 2019 · 1 comment · Fixed by #48
Closed

Automatically get types from memoized function #46

fregante opened this issue May 21, 2019 · 1 comment · Fixed by #48

Comments

@fregante
Copy link
Collaborator

It looks like the types of fn are lost but something like this seems to keep them correctly, including any overloads:

const pMemoize: <T = VoidFunction>(fn: T) => T;

Same for mem. Solution:

declare module 'mem' {
	function mem<T = VoidFunction>(fn: T): T;
	export = mem;
}
@sindresorhus
Copy link
Owner

// @BendingBender

@sindresorhus sindresorhus transferred this issue from sindresorhus/p-memoize Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants