Dumb question about Colyseus typescript syntax

I'm a TS newbie. I see Colyseus example code like

x = 4;

I can't find other examples of this syntax in typescript documentation. What is it? It looks more like type annotations that normally appear in code comments.

Why doesn't it use the typescript colon syntax, as in

x:number = 4;

Hi @tsum, welcome!

That's called a decorator. It is used to expose types to the runtime serializer. Regular TypeScript types are only available during compile time.


@endel Thank you!