preactjs / preactjs/preact

JSX types reflect core + compat, when compat may or may not be used

Open
#4,994 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request types
Dominant language
JavaScript
Stars
38.9k
Forks
2.4k
Avg merge
20h 18m
Merged PRs (30d)
35

Description

Describe the feature you'd love to see

Stemming from a Twitter thread (TODO: go grab link), it's come up a couple times that Preact's JSX types represent a union of core & compat when the latter isn't guaranteed to be used. For example, strokeWidth, an SVG prop, is a React invention and we only support it when compat is used, but it's not a type error for those just using core.

This makes it really easy to run into frustrating bugs as the types say properties are supported when they're really not from core alone.

Additional context (optional)

I banged my head on this for an hour and got no where, TS namespace and declaration merging is a land of misery, pain, and abysmal documentation quality. Tossing this here though as it's a valid issue, even if I can't address it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no file, test, or entry point; begin by locating Preact's JSX type declarations and comparing core-only types with compat types. Done means core-only consumers no longer see compat-only props such as strokeWidth.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.