Summary
API response types use a non-standard tuple pattern [T, ...T[]] to enforce non-empty arrays at the type level, but Zod already validates this at runtime with .nonempty(). This adds unnecessary type complexity.
Current Pattern
export type CreateCategoryResponse = [
z.infer<typeof CreateCategoryResponseSchema>[number],
...z.infer<typeof CreateCategoryResponseSchema>,
];
Proposed Change
export type CreateCategoryResponse = z.infer<typeof CreateCategoryResponseSchema>;
// Trust Zod .nonempty() validation at runtime
Affected Files
src/app/api/category/create-user-category/route.ts
src/app/api/category/update-user-category/route.ts
src/app/api/tags/add-tag-to-bookmark/route.ts
src/app/api/tags/remove-tag-from-bookmark/route.ts
Notes
Breaking Change: API response type changes affect mobile app consumers. Coordinate with mobile team before implementing.
Priority
P3 - Nice to have, low effort (30 min)
Summary
API response types use a non-standard tuple pattern
[T, ...T[]]to enforce non-empty arrays at the type level, but Zod already validates this at runtime with.nonempty(). This adds unnecessary type complexity.Current Pattern
Proposed Change
Affected Files
src/app/api/category/create-user-category/route.tssrc/app/api/category/update-user-category/route.tssrc/app/api/tags/add-tag-to-bookmark/route.tssrc/app/api/tags/remove-tag-from-bookmark/route.tsNotes
Breaking Change: API response type changes affect mobile app consumers. Coordinate with mobile team before implementing.
Priority
P3 - Nice to have, low effort (30 min)