Open
Description
Describe the need
Perhaps I'm missing something, but If I want to write a function that takes in a result of an API call, I can't currently type that parameter. For example:
const workflow = await octokit.rest.actions
.listWorkflowRun(...)
.then(r => r.data.workflows[0]);
doSomethingWithWorkflow(workflow);
function doSomethingWithWorkflow(workflow: ???) {
// do something with the workflow
}
How can I type the workflow
parameter? Looking in the types, I could do:
workflow: RestEndpointMethodTypes["actions"]["listWorkflowRuns"]["response"]["data"]["workflows"][0]
But RestEndpointMethodTypes
is not exported. And it'd be far better to have a type alias e.g. workflow: typeof ListWorkflowRunsResponsePayload[0]
.
For now, I can get around this by indicating the things I want from the workflow:
workflow: { id: number, name: string }
But I assume I'm missing something here...
SDK Version
3.1.2
API Version
No response
Relevant log output
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Type
Projects
Status
🔥 Backlog