Skip to content

fix dropdown-menu commandFor casing and date-picker doc typo#90

Open
jamesism wants to merge 3 commits intomainfrom
fix/docs-and-types
Open

fix dropdown-menu commandFor casing and date-picker doc typo#90
jamesism wants to merge 3 commits intomainfrom
fix/docs-and-types

Conversation

@jamesism
Copy link
Copy Markdown
Collaborator

@jamesism jamesism commented Mar 3, 2026

Two small fixes.

dropdown-menu/index.tsxcommandFor (camelCase) does not exist on DialogHTMLAttributes. Changed to lowercase commandfor to match the HTML attribute.

docs/components/date-picker.md — Pipe characters in the value prop type were unescaped, breaking the markdown table rendering. Escaped as \|.


Unresolved type errors (4)

All four share the same root cause: BaseProps.command and BaseProps.commandFor are typed with | null, but Preact's Signalish<string | undefined> (which wraps all HTML attribute types to support signals) doesn't accept null. Affects aspect-ratio, avatar, and carousel (×2) — all components whose OwnProps extend BaseProps and spread onto a native element.

Options:

  1. Remove | null from BaseProps — but this was added intentionally (commit 7f14577), presumably to support null-clearing signals.
  2. Augment preact.JSX.HTMLAttributes to include command and commandFor typed as string | null, so the global attribute types accept null. Least invasive.
  3. Leave them until Preact's Signalish type is updated to accept null.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 3, 2026

Deploy Preview for kinu-sh ready!

Name Link
🔨 Latest commit 930a967
🔍 Latest deploy log https://app.netlify.com/projects/kinu-sh/deploys/69c02d9ea3bfbf00089b5146
😎 Deploy Preview https://deploy-preview-90--kinu-sh.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

Size Change: -3 B (-0.02%)

Total Size: 14 kB

Filename Size Change
dist/index.js 5.51 kB -3 B (-0.05%)
ℹ️ View Unchanged
Filename Size
dist/index.css 8.53 kB

compressed-size-action

@jamesism jamesism marked this pull request as draft March 3, 2026 14:18
@jamesism jamesism changed the title fix type errors and date-picker doc typo fix dropdown-menu commandFor casing and date-picker doc typo Mar 3, 2026
@developit
Copy link
Copy Markdown
Owner

I like option 2

- aspect-ratio, avatar: remove unnecessary BaseProps extension which
  leaked command/commandFor onto native elements causing null assignability
  errors against Preact's Signalish types
- types.d.ts: augment HTMLAttributes with command/commandfor/commandFor
  so custom attributes are accepted on any native element
- carousel: destructure command/commandFor from props before spreading
  to prevent BaseProps nullables from conflicting with button attributes
- dropdown-menu: use lowercase commandfor on <dialog> (camelCase
  commandFor does not exist on DialogHTMLAttributes)
- docs/components/date-picker.md: escape pipe characters in prop table
  value type so the markdown table renders correctly
The previous commit fixed type errors by modifying component files and
the global type augmentation. Those changes were wrong in intent —
they removed BaseProps from components that should have it, silently
dropped props in carousel, and widened the global augmentation.

The actual root cause was BaseProps allowing null on command and
commandFor, which Preact's Signalish type rejects. Remove the null
from both props in component-props.ts and revert all other changes.
The | null on command and commandFor was added intentionally by the
author. Revert to the original.
@jamesism jamesism force-pushed the fix/docs-and-types branch from 1715c5e to 930a967 Compare March 22, 2026 17:57
@jamesism jamesism marked this pull request as ready for review March 22, 2026 18:01
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