refactor: use solid simple modals (@fehmer)#8044
Conversation
Leonabcd123
left a comment
There was a problem hiding this comment.
For your consideration, more of a style comment.
…ma for convert and min/max options, fix handling of no value
| import { PasswordSchema } from "@monkeytype/schemas/users"; | ||
| import { z, ZodString } from "zod"; | ||
|
|
||
| export type AuthMethod = "password" | "github.com" | "google.com"; |
There was a problem hiding this comment.
I think we should first define an array with all of these values, then infer a union type out of it. This will remove
const authMethods = ["password", "github.com", "google.com"] as AuthMethod[];
in getPreferredAuthenticationMethod, which would make it easier to expand authMethods (only need to change the array instead of both the array and the type).
| export type AuthMethod = "password" | "github.com" | "google.com"; | |
| const authMethods = ["password", "github.com", "google.com"] as const; | |
| export type AuthMethod = typeof authMethods[number]; |
And remove authMethods definition in getPreferredAuthenticationMethod.
| const hasRemainingAuth = [ | ||
| isUsingPasswordAuthentication() && options.authMethod !== "password", | ||
| isUsingGithubAuthentication() && options.authMethod !== "github.com", | ||
| isUsingGoogleAuthentication() && options.authMethod !== "google.com", | ||
| ].find((it) => it); |
There was a problem hiding this comment.
Depends on previous review comment.
| const hasRemainingAuth = [ | |
| isUsingPasswordAuthentication() && options.authMethod !== "password", | |
| isUsingGithubAuthentication() && options.authMethod !== "github.com", | |
| isUsingGoogleAuthentication() && options.authMethod !== "google.com", | |
| ].find((it) => it); | |
| const hasRemainingAuth = authMethods.some((authMethod) => isUsingAuthentication(authMethod) && options.authMethod !== authMethod); |
Need to export isUsingAuthentication and authMethods, also remove isUsingGithubAuthentication and isUsingGoogleAuthentication.
No description provided.