Skip to content

Instantly share code, notes, and snippets.

@Dionid
Created February 3, 2024 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dionid/0e938440614d1bf87c7dad3666d89558 to your computer and use it in GitHub Desktop.
Save Dionid/0e938440614d1bf87c7dad3666d89558 to your computer and use it in GitHub Desktop.
Introspection + models
// instrospection.ts
type UserTable = {
id: string,
email: string,
password: string | null,
active: boolean
}
// models.ts
type UserInactive = UserTable & {
id: UUID,
email: Email,
password: null,
active: false
}
type UserActive = UserTable & {
id: UUID,
email: Email,
password: HashedPassword,
active: true
}
type User = UserInactive | UserActive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment