Improve the type assertion for is.asyncFunction

This commit is contained in:
Sindre Sorhus 2019-11-07 16:28:20 +07:00
parent af6b03d67f
commit c25b606c3b
3 changed files with 8 additions and 3 deletions

View file

@ -560,6 +560,12 @@ test('is.promise', t => {
test('is.asyncFunction', t => {
testType(t, 'asyncFunction', ['function']);
const fixture = async () => {};
if (is.asyncFunction(fixture)) {
// eslint-disable-next-line promise/prefer-await-to-then
t.true(is.function_(fixture().then));
}
});
test('is.generator', t => {