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

Improve types to avoid the runtime error in onetime.callCount() #10

Open
fregante opened this issue Jan 6, 2020 · 1 comment
Open

Comments

@fregante
Copy link
Contributor

fregante commented Jan 6, 2020

I think onetime can return TFunction & {__onetime: true} or a Function that extends both the argument and a private OneTimedFunction type.

@sindresorhus
Copy link
Owner

Yeah, we should make it stricter.

Maybe something like:

<FunctionType extends Function>(
	fn: FunctionType,
	options?: oneTime.Options
): FunctionType & {__isOnetime: true};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants