silas / node-jenkins

Jenkins client
https://www.npmjs.com/package/jenkins
MIT License
356 stars 85 forks source link

fix: make the parameters of job.build api correspond to @types/jenkins #121

Closed Kesonlin closed 10 months ago

Kesonlin commented 10 months ago

when we use this api like:

await jenkins.build(jobName, parameters)

it throws an error "nothing is submitted"

and we have to use like below:

await jenkins.build(jobName, {parameters})

silas commented 10 months ago

I purposely didn't make parameters a positional argument because it is an object and would be hard to differentiate from opts in all cases.

I'd recommend submitting a PR to DefinitelyTyped to fix the types if you don't want to use the build({ name, parameters }) format.

See: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ee122f97a204ac4eb7abc168407cbb54a1acc110/types/jenkins/index.d.ts#L34

Which should be:

build(name: string, opts?: JobBuildOptions): Promise<any>;