jest typescript cannot read property of undefined