Use “toThrowError” and “toThrow” in TypeScript with Objects