typescript - 當 tslint 的 "no-floating-promises" 為 true 時,如何忽略 Jasmine 的 promises
有沒有辦法開啟「no-floating-promises」,但讓它忽略 Jasmine 的 Promise,比如「toEqual」、「toBe」等?我想使用它,但它對我的 expect 語句到處報錯。
expect(1).toEqual(1) // Would complain about this
例如:
答案#1
我在 Jasmine 的 expect 中使用 void 關鍵字。雖然對這是否適當有一些討論:https://github.com/palantir/tslint/issues/4653
void expect(1).toEqual(1) // Would not complain about this
