Skip to content

Conversation

@max-programming
Copy link
Contributor

@max-programming max-programming commented Jan 14, 2026

Background

The Output.choice example in the docs did not include an as const which is useful for propert typesafety when using Output.choice. Without the as const the output is string[] and with the as const it infers that to be one of the options specified.

Summary

Added as const at the end of the options array passed to Output.choice

Before/After

Before

image

After

image

@vercel-ai-sdk vercel-ai-sdk bot added the documentation Improvements or additions to documentation label Jan 14, 2026
Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestions:

  1. Missing as const in Output.choice() options arrays in documentation and examples causes incorrect TypeScript type inference (string[] instead of literal union type)
  1. Missing as const in Output.choice() example in object generation documentation
Fix on Vercel

@lgrammel lgrammel enabled auto-merge (squash) January 14, 2026 13:07
@lgrammel lgrammel self-assigned this Jan 14, 2026
@lgrammel lgrammel merged commit 115b7dc into vercel:main Jan 14, 2026
17 of 18 checks passed
@max-programming max-programming deleted the patch-1 branch January 14, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants