Use WorkflowJob in type guards
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import {ActionStep, Job, ReusableWorkflowJob, RunStep, Step} from "./workflow-template";
|
import {ActionStep, Job, ReusableWorkflowJob, RunStep, Step, WorkflowJob} from "./workflow-template";
|
||||||
|
|
||||||
export function isRunStep(step: Step): step is RunStep {
|
export function isRunStep(step: Step): step is RunStep {
|
||||||
return (step as RunStep).run !== undefined;
|
return (step as RunStep).run !== undefined;
|
||||||
@@ -8,10 +8,10 @@ export function isActionStep(step: Step): step is ActionStep {
|
|||||||
return (step as ActionStep).uses !== undefined;
|
return (step as ActionStep).uses !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isJob(job: Job | ReusableWorkflowJob): job is Job {
|
export function isJob(job: WorkflowJob): job is Job {
|
||||||
return job.type === "job";
|
return job.type === "job";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isReusableWorkflowJob(job: Job | ReusableWorkflowJob): job is ReusableWorkflowJob {
|
export function isReusableWorkflowJob(job: WorkflowJob): job is ReusableWorkflowJob {
|
||||||
return job.type === "reusableWorkflowJob";
|
return job.type === "reusableWorkflowJob";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user