Removing all "any" from back.
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/
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
export interface SetPlayerDetailsMessage {
|
||||
name: string,
|
||||
character: string
|
||||
}
|
||||
import * as tg from "generic-type-guard";
|
||||
|
||||
export const isSetPlayerDetailsMessage =
|
||||
new tg.IsInterface().withProperties({
|
||||
name: tg.isString,
|
||||
character: tg.isString
|
||||
}).get();
|
||||
export type SetPlayerDetailsMessage = tg.GuardedType<typeof isSetPlayerDetailsMessage>;
|
||||
|
||||
Reference in New Issue
Block a user