To do this, I used generic-type-guard package which generates both an interface AND a valid type guard from code. With this, we are 100% sure that the messages we receive are validated at runtime! The client cannot pass us an object that is invalid! \o/
6 lines
227 B
TypeScript
6 lines
227 B
TypeScript
import {PointInterface} from "_Model/Websocket/PointInterface";
|
|
|
|
export class MessageUserJoined {
|
|
constructor(public userId: string, public name: string, public character: string, public position: PointInterface) {
|
|
}
|
|
}
|