Skip to content

Commit

Permalink
Refactor ChannelRawSchema to handle optional
Browse files Browse the repository at this point in the history
customUrl
  • Loading branch information
biplobsd committed Nov 3, 2023
1 parent 9ce9f31 commit ef1a3de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ export const ChannelRawSchema = z
items: z
.object({
snippet: z.object({
customUrl: z.string(),
customUrl: z.string().optional(),
}),
})
.array(),
})
.transform((x) => x.items.map((y) => y.snippet.customUrl));
.transform((x) =>
x.items
.filter((y) => y.snippet.customUrl !== undefined)
.map((y) => y.snippet.customUrl!)
);

export const SubscriptionsListSchema = z
.object({
Expand Down

0 comments on commit ef1a3de

Please sign in to comment.