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

TypeError: hotkey.replace is not a function. (In 'hotkey.replace('++', '+add')', 'hotkey.replace' is undefined) #43

Open
xnukernel opened this issue Sep 25, 2021 · 0 comments

Comments

@xnukernel
Copy link

xnukernel commented Sep 25, 2021

I'm getting a type error within the parseHotkey function in my TypeScript project:

TypeError: hotkey.replace is not a function. (In 'hotkey.replace('++', '+add')', 'hotkey.replace' is undefined)

at:

   125 | var ret = {};
   126 | 
   127 | // Special case to handle the `+` key since we use it as a separator.
 > 128 | hotkey = hotkey.replace('++', '+add');
   129 | var values = hotkey.split('+');
   130 | var length = values.length;

I've imported this using this typescript declaration file:

declare module 'is-hotkey' {
	function isHotkey(event: any)
	function isHotkey(hotkey: (string | string[]), event: any)
	function isHotkey(hotkey: (string | string[]), options: any, event: any)
	function parseHotkey(hotkey: string, options: any)
	function compareHotkey(object: any, event: any)
}

How do I fix this? Or get the compiler to stop complaining.

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

No branches or pull requests

1 participant