Skip to content

Instantly share code, notes, and snippets.

View apotox's full-sized avatar
📚
reading

Safi eddine apotox

📚
reading
  • Senior Software Engineer
  • berlin
View GitHub Profile
@apotox
apotox / game.ts
Created January 9, 2022 17:00
rock-paper-scissors game ts
import canvas, { CANVAS_H, CANVAS_W } from "./canvas";
import Engine from "./engine";
import Button from "./entities/button";
import TouchSystem from "./systems/touch-system";
import { Images } from "./types";
import Client from "./socket-client";
import Counter from "./entities/counter";
import CounterSystem from "./systems/counter-system";
const BASE_URL = window.location.protocol + '//' + window.location.host;
@apotox
apotox / types.ts
Created January 26, 2022 10:47
typescript: make some properties required from an optional props
type SomeRequired<T , TRequired extends keyof T> = T & Required<Pick<T,TRequired>>
//example
type TmpUser = {
photo?: string,
username?: string
}
type User = SomeRequired<TmpUser, 'username'>