fix(ai-grok): remove Record<string,unknown> index sig from GrokTextProviderOptions#835
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesGrok options type fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many --targets=build --exclude=examples/... |
❌ Failed | 4s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-06-25 09:48:31 UTC
…oviderOptions Fixes TanStack#821
079c5a3 to
7ba8441
Compare
…ons (#820) `test:pr`/`test:ci` excluded examples/** and testing/** from every target, so `test:types` never checked the apps where the library is actually consumed — call-site type regressions (e.g. a provider summarize adapter not assignable to `summarize()`) slipped through CI. Because those surfaces were never type-checked, they had also accumulated ~80 latent type errors. CI wiring: - test:pr / test:ci now run a second pass — `test:types` over examples/** and testing/** — after the existing packages-only run. Heavy targets (build/lib/...) stay excluded; only the cheap, high-value type check is added. - Add `test:types:examples` convenience script and document the gate in CLAUDE.md. Coverage: - Add a `test:types` target to every example/testing project that lacked one (e2e, panel, react-native-chat, react-native-smoke). ts-angular-chat type-checks templates via `ngc`, resolved from an existing @angular/build peer (no new dep, no lockfile change). Fixes (examples/testing drift from the current API; nothing under packages/**): - ts-react-chat, ts-solid-chat, ts-code-mode-web: MediaPrompt, maxTokens→modelOptions, ContentPart[] narrowing, transport XOR. - testing/e2e: drop poisoning `as never` model casts, fix adapter/tool typings, OpenRouter summarize httpClient header injection. - testing/panel: AnyAdapter factory maps, AG-UI EventType migration, remove dead app.config.ts (Vinxi-era), rewrite createEventRecording to emit AG-UI StreamChunks. Guard: - packages/ai-grok/tests/summarize-callsite-type-safety.test.ts asserts the grokSummarize → summarize() contract in an included package (@ts-expect-error tracks the known #821 options-shape bug; flips positive when #835 lands). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Summary
grokSummarize('grok-4.3')andgrokSummarize('grok-build-0.1')are not assignable tosummarize()'sadapterparameter, producing a type error at every call site.Fixes #821
Root cause
GrokTextProviderOptionsextends bothGrokBaseOptionsandRecord<string, unknown>. UnderstrictFunctionTypes, function parameters are checked contravariantly. The constraint onsummarize<TAdapter extends SummarizeAdapter<string, object>>means the adapter'ssummarizemethod must acceptSummarizationOptions<object>. Contravariance requiresobjectto be assignable toGrokTextProviderOptions. Butobjectis not assignable toRecord<string, unknown>(index-signature types require a compatible index signature from the source), so the check fails.OpenAI's provider options have no index signature and all-optional named fields, so they pass:
objectsatisfies any all-optional interface.Fix
Remove
Record<string, unknown>from theextendsclause ofGrokTextProviderOptions. All fields are explicitly typed optional members — the index signature was not needed. After this change,objectis assignable toGrokTextProviderOptions(all-optional, no index signature), fixing the contravariant check.GrokBuildProviderOptions(Omit<GrokTextProviderOptions, 'reasoning'>) is not affected: the named fields are preserved correctly byOmitsince there is no longer an index signature to collapse.The
TProviderOptions extends Record<string, unknown>constraint onGrokTextAdapterremains satisfied: a named-property interface withunknown-compatible values is structurally assignable toRecord<string, unknown>.Changes
packages/ai-grok/src/text/text-provider-options.ts: RemoveRecord<string, unknown>fromGrokTextProviderOptionsextends clause.changeset/fix-grok-provider-options-index-sig.md: Patch changeset for@tanstack/ai-grokSummary by CodeRabbit
summarize()call sites.