Coming out of discussions in https://github.com/avajs/ava/issues/2449 we may want to consider supporting additional assertions for use with TypeScript. Say a t.guard(obj, fn) which can be used in an if condition:
if (t.guard(fooOrBar, isFoo)) {
// Do stuff know that we know fooOrBar is Foo
}
Coming out of discussions in https://github.com/avajs/ava/issues/2449 we may want to consider supporting additional assertions for use with TypeScript. Say a
t.guard(obj, fn)
which can be used in anif
condition:Of course AVA does not support custom assertions yet, but keep an eye on https://github.com/avajs/ava/pull/2435.
We'll also have to consider how you might import a test function that has these assertions installed.