We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7403b69 commit ff0783aCopy full SHA for ff0783a
1 file changed
vscode/extension/src/auth/auth.ts
@@ -28,10 +28,16 @@ const tokenSchema = z.object({
28
email: z.string(),
29
})
30
31
-const statusResponseSchema = z.object({
32
- is_logged_in: z.boolean(),
33
- id_token: tokenSchema.optional().nullable(),
34
-})
+const statusResponseSchema = z.discriminatedUnion('is_logged_in', [
+ z.object({
+ is_logged_in: z.literal(true),
+ id_token: tokenSchema,
35
+ }),
36
37
+ is_logged_in: z.literal(false),
38
+ id_token: z.object({}),
39
40
+])
41
42
type StatusResponse = z.infer<typeof statusResponseSchema>
43
0 commit comments