Notes

Its been a while since I did any data modelling in typescript.

TS
// An example of a user management system
// Define user status type, just an enum
type UserAccountStatus = "ACTIVE" | "DORMANT" | "DELETED"
// Define a base type
type BaseUser = { name: string; status: UserAccountStatus }
// Create concrete types using the base type
type ActiveUser = BaseUser & { status: "ACTIVE" }
type DormantUser = BaseUser & { status: "DORMANT" }
type DeletedUser = BaseUser & { status: "DELETED" }
type User = ActiveUser | DormantUser | DeletedUser
// Create the type of function we want to implement
// Make return type a promise because we talk to the DB
type DeleteUser = (user: ActiveUser | DormantUser) => Promise<DeletedUser>
// do a temporary implementation of the function
const deleteUser: DeleteUser = (user) => {
const deletedUser: DeletedUser = { ...user, status: "DELETED" }
// define a helper that we haven't got yet
return writeUserToDB(deletedUser)
}
// declare the type of the helper like so:
declare function writeUserToDB<A extends User>(user: A): Promise<A>

Bought some books with the intention of learning Chinese but yeah its pretty hard.
As long as I don't give up completely I might be ok at it in the region of say... a decade?
Which is really not too long when you think about it.
So I guess nothing to complain.

https://www.youtube.com/watch?v=I9gLrRwLFCs

Tonight is city pop vibes 🗾

nice

Who would have thought YAML was so bad

This was super helpful for implementing webmentions on my site! Thanks!

Am also thinking about upgrading...

Oh, looks like I have to paste the link explicitly for it to work.

Anyways, here it is:

https://blog.rubenwardy.com/2022/03/17/plant-monitor/

Not as cool as this post right here am I rite m8s??? 🌳💻🎉

Nested reply perhaps?

Tom Oliver's profile picture
Tom Oliver
2023/03/05 19:20
2023/03/05 19:20
https://www.youtube.com/watch?v=I9gLrRwLFCs Tonight is city pop vibes 🗾
https://www.tomoliver.net/notes/2023-03-03-2144

This should be a reply???

Tom Oliver's profile picture
Tom Oliver
2023/02/12 19:43
2023/02/12 19:43
Nested reply perhaps?
https://www.tomoliver.net/notes/2023-02-12-1940
Tom Oliver's profile picture
Tom Oliver
2023/03/05 19:20
2023/03/05 19:20
https://www.youtube.com/watch?v=I9gLrRwLFCs Tonight is city pop vibes 🗾
https://www.tomoliver.net/notes/2023-03-03-2144

So this is what shouting into the void feels like...

Hello, this is my first "note".

Probably not going to write too many until I'm sure I have web mentions all working.

Tom Oliver's profile picture
Tom Oliver
2023/02/10 17:47
2023/02/10 17:47
This should be a reply???
https://www.tomoliver.net/notes/2023-02-10-1740
Tom Oliver's profile picture
Tom Oliver
2023/02/12 19:43
2023/02/12 19:43
Nested reply perhaps?
https://www.tomoliver.net/notes/2023-02-12-1940
Tom Oliver's profile picture
Tom Oliver
2023/03/05 19:20
2023/03/05 19:20
https://www.youtube.com/watch?v=I9gLrRwLFCs Tonight is city pop vibes 🗾
https://www.tomoliver.net/notes/2023-03-03-2144