Sandro Maglione

@sandromaglione.bsky.social

The Coding Explorer 💻・Sharing patterns to build type-safe web & mobile apps・Typescript・Effect・React・XState Helping devs at http://typeonce.dev 🚀

✨ TypeScript tip ✨ A function that returns Tagged Classes 👉 Type a class with `new () => T` 👉 Required `Tag` type and value 👉 Return a class with `_tag` Call the function from `extends` to get the class 🪄

Bild

✨ TypeScript Tip ✨ Function overloads with types 👉 Wrap type in `{}` 👉 Provide 2 different signatures Allows to call the same function with different parameters, and different results Runtime problems may apply 🙌 This pattern is useful in library-land to provide a better API for the end user

Bild

Programming literacy in this week newsletter 💡 > The ability to read, write, and understand code; programming concepts, syntax, and semantics, as well as applying skills to solve problems and communicate ideas sandromaglione.com/newsletter

First-draft thoughts on programming, web, games | Sandro Maglione

Every week I explore the sharp edge of web technologies delivering you unfiltered insights on my discoveries, so you can avoid my same mistakes.

sandromaglione.com

✨ TypeScript Tip ✨ Type classes using `new` 👉 `new` keyword 👉 Constructor parameters inside `()` 👉 Class parameters after `=>` You can mark a type as a constructor signature, something that can be instantiated using `new` 👇

Bild