Last active
June 6, 2023 14:42
-
-
Save Dionid/616eb8915d1c2b9bb74a56342cf3dbac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #1 | |
class User { | |
public id: string | |
public password: string | |
public emails: Email[] | |
public deletedAt: Date | null | |
} | |
class Email { | |
public id: string | |
public value: string | |
public isActivated: boolean | |
public main: boolean | |
} | |
class UserService { | |
registerNewUser(password: string, email: string) { | |
// ... | |
} | |
changeUserEmail(user: User, newEmail: string) { | |
// ... | |
} | |
deleteUser(user: User) { | |
// ... | |
} | |
} | |
// #2 | |
type User = { | |
id: string | |
password: string | |
emails: Email[] | |
deletedAt: Date | null | |
} | |
type Email = { | |
id: string | |
value: string | |
isActivated: boolean | |
main: boolean | |
} | |
const registerNewUser = (password: string, email: string) => { | |
// ... | |
} | |
const changeUserEmail = (user: User, newEmail: string) => { | |
// ... | |
} | |
const deleteUser = (user: User) => { | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment