🤖 Merge PR #63278 [is-async-function] Add types for is-async-function by @leondreamed

This commit is contained in:
Leon Si
2022-11-16 17:52:57 -05:00
committed by GitHub
parent e57ff15825
commit fa0c2ac7b1
4 changed files with 44 additions and 0 deletions

8
types/is-async-function/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for is-async-function 2.0
// Project: https://github.com/inspect-js/is-async-function
// Definitions by: Leon Si <https://github.com/leondreamed>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function isAsyncFunction(fn: unknown): boolean;
export = isAsyncFunction;

View File

@@ -0,0 +1,12 @@
import isAsyncFunction = require('is-async-function');
isAsyncFunction(() => {}); // $ExpectType boolean
isAsyncFunction(null); // $ExpectType boolean
// $ExpectType boolean
isAsyncFunction(function*() {
yield 42;
return Infinity;
});
isAsyncFunction(async () => {}); // $ExpectType boolean

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"is-async-function-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "@definitelytyped/dtslint/dt.json" }