mirror of
https://github.com/actions/github-script.git
synced 2025-12-08 08:06:23 +00:00
Expose async-function argument type
We are exposing the async-function argument type for jsDoc
type declaration support. This means that we now could do:
"npm i -D @types/github-script@github:actions/github-script"
and the add:
"@param {import('@types/github-script').AsyncFunctionArguments}
AsyncFunctionArguments".
This could obviously be done in other ways too, like using
"@typed-actions/github-script" instead. But it seems better
to use the actual source repository instead of a third-party
library to import the type declaration.
This commit is contained in:
20
types/async-function.d.ts
vendored
Normal file
20
types/async-function.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/// <reference types="node" />
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import { Context } from '@actions/github/lib/context';
|
||||
import { GitHub } from '@actions/github/lib/utils';
|
||||
import * as glob from '@actions/glob';
|
||||
import * as io from '@actions/io';
|
||||
import fetch from 'node-fetch';
|
||||
export declare type AsyncFunctionArguments = {
|
||||
context: Context;
|
||||
core: typeof core;
|
||||
github: InstanceType<typeof GitHub>;
|
||||
exec: typeof exec;
|
||||
glob: typeof glob;
|
||||
io: typeof io;
|
||||
fetch: typeof fetch;
|
||||
require: NodeRequire;
|
||||
__original_require__: NodeRequire;
|
||||
};
|
||||
export declare function callAsyncFunction<T>(args: AsyncFunctionArguments, source: string): Promise<T>;
|
||||
Reference in New Issue
Block a user