Everything, anything, everywhere with Typescript

Sandro Maglione

Sandro Maglione

Web development

What language should I learn? Typescript.

This answer is becoming more and more absolute for me.

As I explored some new libraries and patterns this week, it never stops surprising me how extensive is the Typescript ecosystem, and how much can you do with it (TLDR anything ๐Ÿคฏ)

This is what I discovered ๐Ÿ‘‡


Always bet on "it's just Typescript"

Typescript runs everywhere: client, server, mobile, desktop, iot.

Result: When a library is pure Typescript, such library can be used everywhere, in any project

This thought came out as people started considering Effect a "different language".

It's not. It's just Typescript. And that's exactly what makes it so powerful ๐Ÿ”ฅ

Make games with Typescript

If I can use Typescript for anything, how about games? ๐Ÿค”

Turns out that you can (of course ๐Ÿ’๐Ÿผโ€โ™‚๏ธ).

I tried a library called excaliburjs.

What's more, since all Typescript libraries can work together, why not use Effect at the same time?

Turns out that you can (of course ๐Ÿ’๐Ÿผโ€โ™‚๏ธ).

I made games with every tool (Unity, Godot, Flutter, Constructor). Looking forward to try a full game also in Typescript with excaliburjs ๐Ÿ”œ

There is more.

Every week I build a new open source project, with a new language or library, and teach you how I did it, what I learned, and how you can do the same. Join me and other 700+ readers.

Actor model: yes you can in Typescript!

Another rabbit hole I explored this week is XState.

Wait, again? Yes.

I have been talking about XState a lot in the past, but it turns out there is still more to discover ๐Ÿ‘€

XState v5 makes actor-to-actor messaging a breeze. This allows to implement state machines in isolation and communicate between them by sending events.

XState also allows to access each machine context with ease, everywhere you have an actor ๐Ÿช„

There is even more ๐Ÿš€ `useSelector` allows to access the internal context of a spawned actor ๐Ÿช„ All type safe and performant ๐Ÿค

Image
Image
Sandro Maglione
Sandro Maglione
@SandroMaglione

Actors in XState v5 are insane ๐Ÿ”ฅ @statelyai Isolate state machines logic and emit events to interact between them ๐Ÿ” ๐Ÿ‘‰ `spawn` machines ๐Ÿ‘‰ `emit` events from spawned machine ๐Ÿ‘‰ Subscribe `on` events in root machine

Image
Image
15
Reply

Did you know that state machines are used extensively in games?

Since it's all "just Typescript", you can use XState with excaliburjs as well ๐Ÿš€

And much much more

For completeness, here is what you can also explore:

  • Desktop apps: Tauri
  • Mobile apps: React native
  • Local first apps: Dxos
  • Web & Server: Bun
  • And pretty much any API everywhere provides a Typescript SDK ๐Ÿ’๐Ÿผโ€โ™‚๏ธ

There is no doubt that Typescript is a safe bet ๐Ÿค

You can then mix and match all the libraries in the ecosystem to build anything, at any scale.

And it's getting better and better ๐Ÿ‘€

See you next ๐Ÿ‘‹

Start here.

Every week I build a new open source project, with a new language or library, and teach you how I did it, what I learned, and how you can do the same. Join me and other 700+ readers.