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

Problem extending DOMAttributes type with new typescript typings. #1544

Closed
mseddon opened this issue Apr 17, 2019 · 2 comments
Closed

Problem extending DOMAttributes type with new typescript typings. #1544

mseddon opened this issue Apr 17, 2019 · 2 comments

Comments

@mseddon
Copy link
Contributor

mseddon commented Apr 17, 2019

I used to be able to attach new attribute types to preact by doing something like:

declare namespace JSX {
	interface DOMAttributes {
		onSwipeStart?: (e: any) => void;
		onSwipeEnd?: (e: any) => void;
		onSwipeMove?: (e: any) => void;
	}
}

Since #1448, JSX has gone, but attempting:

declare namespace preact.JSX {
	interface DOMAttributes {
		onSwipeStart?: (e: any) => void;
		onSwipeEnd?: (e: any) => void;
		onSwipeMove?: (e: any) => void;
	}
}

causes every jsx element to type error with:

{ children: Element[] } has no properties in common with 'HTMLAttributes'.

What is the correct way to add new events like this since the change? Thanks!

@maxpatiiuk
Copy link

This solved it for me:
#1180 (comment)

@marvinhagemeister
Copy link
Member

Closing as duplicate of #1180

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

3 participants