Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rschristian
Copy link
Contributor

@rschristian rschristian commented Feb 16, 2025

Re: preactjs/preact-www#1240

  1. Fixes the paths in the tsconfig.json, which were copied w/out accounting for the set baseUrl
  2. Preact doesn't provide JSX as a global type as this conflicts & clashes with all other JSX configurations. React recently stopped providing this as a global too.
  3. Switch to event.currentTarget. .target is the original target of the event and can be any HTML element, requiring type casts. .currentTarget should be preferred in vanilla JS or any framework that uses native events (like Preact).
  4. Switch to .spellcheck. While we support some of React's made up property cases, we're generally trying to cut back on that. .spellcheck is the native DOM casing and therefore the casing we support. .spellCheck will intentionally fail type checks, though at runtime it'll usually work (but it'll be set as an attribute, not as a property).

Fixed Upstream:

  1. Preact was missing types for auxclick events: types: Add auxClick event types preactjs/preact#4672
  2. Preact wasn't exposing AriaAttributes from compat: types: Expose AriaAttributes from compat preactjs/preact#4673
  3. Preact wasn't exposing EventHandler from compat: types: Expose EventHandler from compat preactjs/preact#4674
  4. Preact was missing a type for ForwardRefRenderFunction: types: Add FowardRefRenderFunction type to compat preactjs/preact#4675

There's still a few type errors (excluding those which need a new Preact release, but that'll be in the next few days likely) that I don't quite know how to fix or if they're even Preact errors.

@nkprasad12 nkprasad12 marked this pull request as ready for review February 16, 2025 14:29
@nkprasad12 nkprasad12 self-requested a review as a code owner February 16, 2025 14:29
@nkprasad12 nkprasad12 merged commit acef99c into nkprasad12:preact Feb 16, 2025
@rschristian rschristian deleted the fix/preact-types branch February 16, 2025 18:50
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

Successfully merging this pull request may close these issues.

2 participants