Simplify types

This commit is contained in:
schmelczerandras 2020-10-06 14:08:43 +02:00
parent 6eddb4834b
commit ba8b1a29fd
30 changed files with 52 additions and 76 deletions

View file

@ -2,8 +2,6 @@ import { vec2 } from 'gl-matrix';
import { Command } from 'shared';
export class MoveToCommand extends Command {
public static readonly type = 'MoveToCommand';
public constructor(public readonly position: vec2) {
super();
}

View file

@ -2,8 +2,6 @@ import { Renderer } from 'sdf-2d';
import { Command } from 'shared';
export class RenderCommand extends Command {
public static readonly type = 'RenderCommand';
public constructor(public readonly renderer: Renderer) {
super();
}

View file

@ -22,7 +22,7 @@ export const deserialize = (json: string): GameObject => {
};
export const deserializeJsonArray = (json: string): Array<GameObject> => {
return (JSON.parse(json) as Array<any>).map(
([type, ...values]) => new constructors[type](...values)
);
return (JSON.parse(json) as Array<any>).map(([type, ...values]) => {
return new constructors[type](...values);
});
};