Skip to content

Commit 821d4f4

Browse files
authored
feat: add types (#12)
This makes it possible to use process-on-spawn in a typescript context more easily.
1 parent 65e372b commit 821d4f4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

index.d.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/// <reference types="node" />
2+
export namespace ProcessOnSpawn {
3+
export interface SpawnOptions {
4+
env: NodeJS.ProcessEnv
5+
cwd: string
6+
execPath: string
7+
args: ReadonlyArray<string>
8+
detached: boolean
9+
uid?: number
10+
gid?: number
11+
windowsVerbatimArguments: boolean
12+
windowsHide: boolean
13+
}
14+
export type Handler = (opts: SpawnOptions) => any
15+
}
16+
export function addListener(fn: ProcessOnSpawn.Handler): void
17+
export function prependListener(fn: ProcessOnSpawn.Handler): void
18+
export function removeListener(fn: ProcessOnSpawn.Handler): void
19+
export function removeAllListeners(): void

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"fromentries": "^1.2.0"
3232
},
3333
"devDependencies": {
34+
"@types/node": "^20.1.3",
3435
"c8": "^7.0.0",
3536
"if-ver": "^1.1.0",
3637
"standard-version": "^8.0.0",

0 commit comments

Comments
 (0)