Merge pull request #26376 from Archcry/feat-node-process-env

Add "ProcessEnv" interface to types for node versions 4, 6 and 7
This commit is contained in:
Mine Starks
2018-06-13 08:58:25 -07:00
committed by GitHub
6 changed files with 21 additions and 42 deletions
+6 -1
View File
@@ -3,6 +3,7 @@
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>
// DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
// Sebastian Silbermann <https://github.com/eps1lon>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -407,6 +408,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface Process extends EventEmitter {
stdout: Socket;
stderr: Socket;
@@ -418,7 +423,7 @@ declare namespace NodeJS {
chdir(directory: string): void;
cwd(): string;
debugPort: number;
env: any;
env: ProcessEnv;
exit(code?: number): void;
exitCode: number;
getgid(): number;
+1 -13
View File
@@ -734,19 +734,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
+6 -1
View File
@@ -7,6 +7,7 @@
// Sebastian Silbermann <https://github.com/eps1lon>
// Alorel <https://github.com/Alorel>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -460,6 +461,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface WriteStream extends Socket {
columns?: number;
rows?: number;
@@ -482,7 +487,7 @@ declare namespace NodeJS {
cwd(): string;
debugPort: number;
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
env: any;
env: ProcessEnv;
exit(code?: number): void;
exitCode: number;
getgid(): number;
+1 -13
View File
@@ -1364,19 +1364,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
+6 -1
View File
@@ -7,6 +7,7 @@
// Wilco Bakker <https://github.com/WilcoBakker>
// Sebastian Silbermann <https://github.com/eps1lon>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -456,6 +457,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface WriteStream extends Socket {
columns?: number;
rows?: number;
@@ -479,7 +484,7 @@ declare namespace NodeJS {
cwd(): string;
debugPort: number;
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
env: any;
env: ProcessEnv;
exit(code?: number): never;
exitCode: number;
getgid(): number;
+1 -13
View File
@@ -1346,19 +1346,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns