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

onkeyup event expecting incorrect type #532

Open
timandella opened this issue Aug 17, 2023 · 0 comments
Open

onkeyup event expecting incorrect type #532

timandella opened this issue Aug 17, 2023 · 0 comments

Comments

@timandella
Copy link

We have the following line of code in our angular project (where this.editor is the FroalaEditor component)

this.editor.events.on('keyup', (e: Event) => this.onKeyup.emit(new ComponentEvent('keyup', null, e)), false);

This was building fine in 4.1.0, but in 4.1.1 we now get a typescript error

Argument of type '(e: Event) => void' is not assignable to parameter of type '(event: string, param1?: any, param2?: any) => boolean | void'.

However, I added a console.log(e) to the function like so:

this.editor.events.on(
	'keyup',
	(e: string) => {
		console.log(e);
		this.onKeyup.emit(new ComponentEvent('keyup', null));
	},
	false,
);

This then reveals that although it may be expecting a string, it is actually still being passed in an event.

{altKey: false, bubbles: true, cancelable: true, changedTouches: undefined, ctrlKey: false, …}

@timandella timandella changed the title onkeyup event onkeyup event expecting incorrect type Aug 17, 2023
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