Domain driven design and type checking for JavaScript