Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/essential/best-practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ import type { AuthModel } from './model'
// If a class doesn't need to store a property,
// you can use an `abstract class` to avoid class allocation
export abstract class Auth {
static async signIn({ username, password }: AuthModel.signInBody) {
static async signIn({ username, password }: AuthModel['signInBody']) {
const user = await sql`
SELECT password
FROM users
Expand All @@ -149,7 +149,7 @@ export abstract class Auth {
// You can throw an HTTP error directly
throw status(
400,
'Invalid username or password' satisfies AuthModel.signInInvalid
'Invalid username or password' satisfies AuthModel['signInInvalid']
)

return {
Expand All @@ -164,7 +164,7 @@ export abstract class Auth {
// Model define the data structure and validation for the request and response
import { t, type UnwrapSchema } from 'elysia'

const AuthModel = {
export const AuthModel = {
signInBody: t.Object({
username: t.String(),
password: t.String(),
Expand Down