TypeScript features in JavaScript

Hi Endel,

I was looking at using the EntityMap type - is there a way to use this from native JS?
Also the decorators (like @nosync) - can I use those from native JS / or is there a workaround?


Hi @njohnst,

Here's a post about using nosync in pure JavaScript: https://discuss.colyseus.io/topic/102/how-to-use-nosync-in-nodejs

The EntityMap is just a type for {[ entityId: string ]: T}, you can replicate the same thing in JavaScript using:

this.entities = {};
this.entities[entityId] = yourEntity;

Hope this helps, cheers!

That solved my problem.

Thanks @endel !