Skip to content

Fix provider enum type casting for zod validation#323

Draft
Copilot wants to merge 2 commits intorefactor/monorepo-with-sddfrom
copilot/sub-pr-321-again
Draft

Fix provider enum type casting for zod validation#323
Copilot wants to merge 2 commits intorefactor/monorepo-with-sddfrom
copilot/sub-pr-321-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Addressed type safety issue where Object.values(Providers) returns string[] but z.enum() requires [string, ...string[]].

Changes

  • Extract Object.values(Providers) into typed constant with explicit cast to [string, ...string[]]
  • Update schema to use typed constant instead of inline Object.values() call

Implementation

// Before
provider: z.enum(Object.values(Providers)).default(DEFAULT_PROVIDER).optional()

// After  
const providerValues = Object.values(Providers) as [string, ...string[]];
provider: z.enum(providerValues).default(DEFAULT_PROVIDER).optional()

Maintains existing Providers enum usage while satisfying zod's tuple type requirements.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: wildan3105 <7030099+wildan3105@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on monorepo refactor and spec-driven development Fix provider enum type casting for zod validation Feb 14, 2026
Copilot AI requested a review from wildan3105 February 14, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants