Text adapters fail chat()'s adapter constraint under exactOptionalPropertyTypes (midConversationChannels)
メンテナーはふだん 1 日以内に返信
@tombeckenham がすでに取り組んでいます。
2026年10月14日 から。
評価
この issue はまだ評価されていません。
説明
TanStack AI version
@tanstack/ai 0.69.0 (regression from 0.68.0)
Framework/Library version
TypeScript 6.0.3 with strict and exactOptionalPropertyTypes. Framework-independent.
Describe the bug and the steps to reproduce it
Under exactOptionalPropertyTypes, no text adapter class satisfies chat()'s AnyTextAdapter constraint in 0.69.0, including the built-in fakeText() and the Anthropic and OpenAI adapters. This is the same defect #1702 reported for inputModalities, which #1707 fixed. The new midConversationChannels field from #1697 reintroduces it.
In packages/ai/src/activities/chat/adapter.ts, the TextAdapter interface declares the field without | undefined:
readonly midConversationChannels?: MidConversationChannels
but BaseTextAdapter declares it with | undefined:
readonly midConversationChannels?: MidConversationChannels | undefined = undefined
so every subclass is unassignable to the interface. Adding | undefined to the interface field, as #1707 did for inputModalities, should fix it.
Steps:
- Install
@tanstack/[email protected]and[email protected]. - Typecheck
repro.tswith thetsconfig.jsonbelow.
{ "compilerOptions": { "strict": true, "exactOptionalPropertyTypes": true, "module": "nodenext", "target": "es2022", "noEmit": true, "skipLibCheck": true }, "files": ["repro.ts"] }
import { chat } from "@tanstack/ai"
import { fakeText } from "@tanstack/ai/testing"
chat({ adapter: fakeText(), messages: [{ role: "user", content: "Hi" }] })
Result with 0.69.0:
repro.ts(4,8): error TS2375: Type 'FakeTextAdapter<"fake-model", readonly ("text" | "image" | "audio" | "video" | "document")[]>' is not assignable to type 'AnyTextAdapter' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'midConversationChannels' are incompatible.
Type 'MidConversationChannels | undefined' is not assignable to type 'MidConversationChannels'.
Type 'undefined' is not assignable to type 'MidConversationChannels'.
The same files typecheck without errors against 0.68.0.
As a workaround, we set an explicit all-off value, { tools: false, systemPrompts: false }, which chat() treats the same as an absent value.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
The three files above are the complete reproduction.
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I don't have time to work on this right now
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- 主要言語
- TypeScript
- スター
- 3.2k
- フォーク
- 365
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 263
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/ai のほかの issue
-
openai-base: a tool call cut off by finish_reason "length" is reported as "tool_calls" and re-sent対応中かも @tombeckenham が今日担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
ai-ollama: streamed chat() reports finishReason "stop" when done_reason is "length"対応中かも @AlemTuzlak が今日担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
ai-vercel-gateway: surface provider_metadata.gateway cost on usage (usage.cost)対応中かも @tombeckenham が 1 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
withPersistence does not save activity rows when a run is stopped or fails対応中かも @tombeckenham が 6 日前に担当しました。 オープンwaiting-on: maintainer
メンテナーはふだん 1 日以内に返信
-
Discriminate status-dependent record and option types (RunRecord, SessionIndexEntry, InputState, durable-only options)対応中かも @jherr が 6 日前に担当しました。 オープンenhancement waiting-on: maintainer
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
cursor/community-plugins#465 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
vetro-protocol/vetro-monorepo#978 ·
メンテナーはふだん 1 日以内に返信
-
ai-generated bug category:security effort:s priority:p3
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
LanternOps/breeze#9697 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
maniator/verticopolis#1303 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
components-web-app/docs#297 ·