Skip to content

fix(Typeahead): propagate generic type through CreateStaticSourceOptions - #2014

Merged
cixzhang merged 1 commit into
mainfrom
navi/fix/create-static-source-generic
May 3, 2026
Merged

fix(Typeahead): propagate generic type through CreateStaticSourceOptions#2014
cixzhang merged 1 commit into
mainfrom
navi/fix/create-static-source-generic

Conversation

@cixzhang

@cixzhang cixzhang commented May 3, 2026

Copy link
Copy Markdown
Contributor

Thread the generic T from createStaticSource into CreateStaticSourceOptions so the keywords callback receives the fully-typed item instead of XDSSearchableItem with auxiliaryData: unknown.

Before

const source = createStaticSource(items, {
  keywords: (item) => {
    item.auxiliaryData.category; // TS18046 — auxiliaryData is 'unknown'
  },
});

After

const source = createStaticSource(items, {
  keywords: (item) => {
    item.auxiliaryData.category; // ✓ fully typed
  },
});

The default type parameter (= XDSSearchableItem) preserves backward compatibility — existing code that uses CreateStaticSourceOptions without a type argument continues to work unchanged.

Closes #1979

Thread the generic T from createStaticSource into CreateStaticSourceOptions
so the keywords callback receives the fully-typed item instead of
XDSSearchableItem with auxiliaryData: unknown.

Closes #1979
@vercel

vercel Bot commented May 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
xds-sandbox Ready Ready Preview, Comment May 3, 2026 6:54pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label May 3, 2026
@github-actions

github-actions Bot commented May 3, 2026

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 18.0KB 27.8KB 4.2KB

Accessibility Audit

Status: No accessibility violations detected.


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

@cixzhang
cixzhang merged commit 2c64c26 into main May 3, 2026
20 checks passed
@github-actions
github-actions Bot deleted the navi/fix/create-static-source-generic branch May 4, 2026 07:11
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.

fix(Typeahead): createStaticSource generic type doesn't flow into keywords callback

1 participant