If you loop over fullStream from streamText and switch on part.type with an assertNever fallback, bumping ai from 7.0.162 to anything from 7.0.163 up will break your type check. Nothing is wrong at runtime. The union just got two new members in a patch release.
I hit this on purpose to see exactly what changes, so here's the error, why it happens, and the fix.
The error
This is a normal exhaustive handler. It compiles cleanly against [email protected] :
import type { TextStreamPart , ToolSet } from ' ai ' ;
function assertNever ( value : never ): never { throw new Error ( `Unhandled stream part: ${ JSON . stringify ( value )} ` ); }
export function describePart ( part : TextStreamPart < ToolSet > ): string { switch ( part . type ) { case ' start ' : case ' start-step ' : case ' finish-step ' : case ' finish ' : return part . type ; case ' text-start ' : case ' text-end ' : case ' reasoning-start ' : case ' reasoning-end ' : return part . type ; case ' text-delta ' : case ' reasoning-delta ' : return part .…