QwikDev / QwikDev/qwik

[📖] Document how to extend JSX attributes. (Potential Feature Suggestion)

Open
#4,739 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs DX types waiting for team
Dominant language
TypeScript
Stars
22.1k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

Suggestion

Hello all.

I've seen this asked about multiple times in the Discord, and have yet to see an answer provided, so I thought this was the next best idea.


Many Vite plugins (see UnoCSS) add/change properties on HTML elements.

With TypeScript, errors are raised when an unknown attribute is found.

In other frameworks you can extend the JSX HTMLAttributes interface in a custom shims.d.ts or similar.

For example, in SolidJS, using UnoCSS preset-attributify:

import type { AttributifyAttributes } from '@unocss/preset-attributify'

declare module 'solid-js' {
  namespace JSX {
    interface HTMLAttributes<T> extends AttributifyAttributes {}
  }
}

I still haven't figured out how to do this in Qwik. I'm a noob when it comes to JSX internals though, so it could just be me.

My suggestion is that extending JSX attributes be clearly documented

(or if there is currently no support, add it; hence "Potential Feature Request")

Regards,

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

Start by checking Qwik's existing JSX and TypeScript type declarations alongside its documentation for JSX or HTML attributes. Document the supported way to extend JSX attributes for custom properties, using the UnoCSS example as a reference, or clearly explain if Qwik does not support this.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.