Skip to content

feat(types): add data-* index signature to XDSBaseProps - #1502

Merged
cixzhang merged 1 commit into
mainfrom
navi/feat/data-attrs-index-signature
Apr 19, 2026
Merged

feat(types): add data-* index signature to XDSBaseProps#1502
cixzhang merged 1 commit into
mainfrom
navi/feat/data-attrs-index-signature

Conversation

@cixzhang

@cixzhang cixzhang commented Apr 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a [key: \data-${string}`]: string | undefinedindex signature toXDSBaseProps, allowing data-*` attributes in object literal prop spreads — not just direct JSX usage.

Problem

TypeScript's JSX transform has special handling for data-* attributes, but when constructing props as an object literal (e.g. passing the button prop to XDSDropdownMenu), TS rejects data-* keys with TS2353 (excess property check).

Fix

Narrow index signature that only allows data- prefixed keys — no arbitrary props leak through.

Closes #1392


Allows data-* attributes in object literal prop spreads, not just
direct JSX usage. Fixes the TS2353 excess property check error when
passing data-* keys through component prop objects (e.g. XDSDropdownMenu's
button prop).

Closes #1392

Co-authored-by: Navi <navi@navibot.dev>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 19, 2026
@cixzhang
cixzhang enabled auto-merge (squash) April 19, 2026 18:30
@cixzhang
cixzhang merged commit fbdae42 into main Apr 19, 2026
16 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 16.1KB 25.3KB 3.8KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XDSBaseProps: add data-* index signature for object literal compatibility

1 participant