标签: typescript jasmine rxjs
如何检查错误是TypeError? 我想做这样的事情:
TypeError
myObservable.subscribe(() => {}, (error) => { expect(typeOf error).toEqual('TypeError'); });
答案 0 :(得分:1)
您是否尝试过instanceof type guards?
const val = error instanceof TypeError; expect(val).toEqual(true);