Text adapters fail chat()'s adapter constraint under exactOptionalPropertyTypes (midConversationChannels)
Maintainer thường phản hồi trong vòng 1 ngày
@tombeckenham đang làm issue này rồi.
Từ ngày 14/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.2k
- Fork
- 361
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 252
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/ai
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Responses replay puts assistant text between function_call and function_call_outputCó thể đã có người làm @tombeckenham đã nhận hôm nay. Đang mởwaiting-on: maintainer
TanStack/ai#1792 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
move to modelschemasCó thể đã có người làm @jherr đã nhận hôm nay. Đang mởhas-pr waiting-on: maintainer
TanStack/ai#1788 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chat(): sign the state of a suspended run so a resume without persistence cannot change itCó thể đã có người làm @AlemTuzlak đã nhận 2 ngày trước. Đang mởwaiting-on: maintainer
TanStack/ai#1740 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
@tanstack/ai-anthropic: a stream that fails after message_start loses the call's input usageCó thể đã có người làm @AlemTuzlak đã nhận 2 ngày trước. Đang mởwaiting-on: maintainer
TanStack/ai#1735 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
stellar/stellar-dev-skill#151 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Trial & Error: guided Blind offer squeezes on phones and sits under the touch toolbar on iPadĐang mởarea:arcade game ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
fderuiter/deruiter.dev#2281 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
scope: data grid type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
fix(frontend): correct VITE_IS_DEVELPOMENT typo in shared/app.ts and align dev environment flagsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vicharanashala/ajrasakha#1439 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: TV5Monde AsieĐang mởapproved check:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày