GoF design pattern implemented in Typescript