-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
The JSX namespace in TypeScript has a special meaning. There’s a specific set of types that can be defined in a JSX namespace to make JSX behave in a certain way. This is (partially) documented here.
The following properties have a special meaning:
ElementElementClassElementAttributesPropertyElementChildrenAttributeIntrinsicAttributesIntrinsicElementsLibraryManagedAttributes
However, in the Preact typings the following types are also defined on the JSX namespace:
SVGAttributesPathAttributesDOMAttributesHTMLAttributes
Events and event handlers
TargetedEventTargetedAnimationEventTargetedClipboardEventTargetedCompositionEventTargetedDragEventTargetedFocusEventTargetedKeyboardEventTargetedMouseEventTargetedPointerEventTargetedTouchEventTargetedTransitionEventTargetedUIEventTargetedWheelEventEventHandlerAnimationEventHandlerClipboardEventHandlerCompositionEventHandlerDragEventHandlerFocusEventHandlerGenericEventHandlerKeyboardEventHandlerMouseEventHandlerPointerEventHandlerTouchEventHandlerTransitionEventHandlerUIEventHandlerWheelEventHandler
The JSX namespace in Preact is called JSXInternal. This makes it unclear if these types are supposed to be consumed or not.
Since these types are useful, especially the event handlers, I propose to move all these types to the preact namespace instead. The JSXInternal namespace can import these types an expose type aliases using the @deprecated annotation. They can be removed in the next major release.