Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Text adapters fail chat()'s adapter constraint under exactOptionalPropertyTypes (midConversationChannels)

Abierto
#1,777 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@tombeckenham ya está trabajando en esto.

Desde el 14/10/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

waiting-on: maintainer
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:

  1. Install @tanstack/[email protected] and [email protected].
  2. Typecheck repro.ts with the tsconfig.json below.
{ "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.
Lenguaje dominante
TypeScript
Estrellas
3.2k
Forks
365
Merge medio
1 d 9 h
PR fusionados (30 d)
242

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TanStack/ai

Todos los issues de TanStack/ai

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.