Book: Kotlin and Java to TypeScript
Also by me: The TypeScript Library — the 5-book collection
My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools
Me: xgabriel.com | GitHub
A Kotlin developer joins a TypeScript codebase. They need a User with two fields set, so they write what their fingers know:
val user = User (). apply { name = "alice" age = 30 }
Enter fullscreen mode
Exit fullscreen mode
They translate. There's no apply in TypeScript, so they reach for a builder:
class UserBuilder { private user : Partial < User > = {}; setName ( n : string ) { this . user . name = n ; return this ; } setAge ( a : number ) { this . user . age = a ; return this ; } build (): User { return this . user as User ; } }
const user = new UserBuilder (). setName ( " alice " ). setAge ( 30 ).…