Avoid using NodeJS global type (#1032)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent fee011d · Browse files · 4 files·+13 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Diff stats
4 files+13 added−8 removed
- other:+13 added−8 removed
Provenance
- Commit
398d090- Tree
25a2a4e- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
fee011d
4 files changed+13 added−8 removed
modified:test-d/return/result-main.test-d.ts+5 added-4 removed
1234522 unmodified lines282930313132333435367 unmodified lines444546474748495051528 unmodified lines6162636464656667686913 unmodified lines838485868687888990915 unmodified linesimport type {SignalConstants} from 'node:os';import {expectType, expectAssignable} from 'tsd';import { execa, execaSync,22 unmodified linesexpectType<boolean>(unicornsResult.timedOut);expectType<boolean>(unicornsResult.isCanceled);expectType<boolean>(unicornsResult.isTerminated);expectType<boolean>(unicornsResult.isMaxBuffer);expectType<NodeJS.Signals | undefined>(unicornsResult.signal);expectType<keyof SignalConstants | undefined>(unicornsResult.signal);expectType<string | undefined>(unicornsResult.signalDescription);expectType<string>(unicornsResult.cwd);expectType<number>(unicornsResult.durationMs);expectType<Result[]>(unicornsResult.pipedFrom);7 unmodified linesexpectType<boolean>(unicornsResultSync.timedOut);expectType<boolean>(unicornsResultSync.isCanceled);expectType<boolean>(unicornsResultSync.isTerminated);expectType<boolean>(unicornsResultSync.isMaxBuffer);expectType<NodeJS.Signals | undefined>(unicornsResultSync.signal);expectType<keyof SignalConstants | undefined>(unicornsResultSync.signal);expectType<string | undefined>(unicornsResultSync.signalDescription);expectType<string>(unicornsResultSync.cwd);expectType<number>(unicornsResultSync.durationMs);expectType<[]>(unicornsResultSync.pipedFrom);8 unmodified lines expectType<boolean>(error.timedOut); expectType<boolean>(error.isCanceled); expectType<boolean>(error.isTerminated); expectType<boolean>(error.isMaxBuffer); expectType<NodeJS.Signals | undefined>(error.signal); expectType<keyof SignalConstants | undefined>(error.signal); expectType<string | undefined>(error.signalDescription); expectType<string>(error.cwd); expectType<number>(error.durationMs); expectType<string>(error.shortMessage);13 unmodified lines expectType<boolean>(errorSync.timedOut); expectType<boolean>(errorSync.isCanceled); expectType<boolean>(errorSync.isTerminated); expectType<boolean>(errorSync.isMaxBuffer); expectType<NodeJS.Signals | undefined>(errorSync.signal); expectType<keyof SignalConstants | undefined>(errorSync.signal); expectType<string | undefined>(errorSync.signalDescription); expectType<string>(errorSync.cwd); expectType<number>(errorSync.durationMs); expectType<string>(errorSync.shortMessage);5 unmodified linesmodified:types/arguments/options.d.ts+4 added-2 removed
1+import type {SignalConstants} from 'node:os';2+import type {env} from 'node:process';3 import type {Readable} from 'node:stream';4 import type {Unless} from '../utils.js';5 import type {StdinOptionCommon, StdoutStderrOptionCommon, StdioOptionsProperty} from '../stdio/type.js';6 import type {FdGenericOption} from './specific.js';67 unmodified lines74 Unless the `extendEnv` option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).75 76 @default [process.env](https://nodejs.org/api/process.html#processenv)77 */76- readonly env?: NodeJS.ProcessEnv;78+ readonly env?: typeof env;79 80 /**81 If `true`, the subprocess uses both the `env` option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).82 If `false`, only the `env` option is used, not `process.env`.196 unmodified lines279 This can be either a name (like `'SIGTERM'`) or a number (like `9`).280 281 @default 'SIGTERM'282 */281- readonly killSignal?: NodeJS.Signals | number;283+ readonly killSignal?: keyof SignalConstants | number;284 285 /**286 Run the subprocess independently from the current process.287 85 unmodified linesmodified:types/return/result.d.ts+2 added-1 removed
1+import type {SignalConstants} from 'node:os';2 import type {Unless} from '../utils.js';3 import type {CommonOptions, Options, SyncOptions} from '../arguments/options.js';4 import type {ErrorProperties} from './final-error.js';5 import type {ResultAll} from './result-all.js';111 unmodified lines117 - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).118 119 If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`.120 */120- signal?: NodeJS.Signals;121+ signal?: keyof SignalConstants;122 123 /**124 A human-friendly description of the signal that was used to terminate the subprocess.125 65 unmodified linesmodified:types/subprocess/subprocess.d.ts+2 added-1 removed
1 import type {ChildProcess} from 'node:child_process';2+import type {SignalConstants} from 'node:os';3 import type {Readable, Writable, Duplex} from 'node:stream';4 import type {StdioOptionsArray} from '../stdio/type.js';5 import type {Options} from '../arguments/options.js';6 import type {Result} from '../return/result.js';79 unmodified lines86 When an error is passed as argument, it is set to the subprocess' `error.cause`. The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).87 88 [More info.](https://nodejs.org/api/child_process.html#subprocesskillsignal)89 */89- kill(signal?: NodeJS.Signals | number, error?: Error): boolean;90+ kill(signal?: keyof SignalConstants | number, error?: Error): boolean;91 kill(error?: Error): boolean;92 93 /**94 Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.39 unmodified lines