mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
node: signatures of module "os" have been changed
This commit is contained in:
@@ -14,6 +14,7 @@ import * as querystring from "querystring";
|
||||
import * as path from "path";
|
||||
import * as readline from "readline";
|
||||
import * as childProcess from "child_process";
|
||||
import * as os from "os";
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -411,3 +412,49 @@ rl.question("do you like typescript?", function(answer: string) {
|
||||
|
||||
childProcess.exec("echo test");
|
||||
childProcess.spawnSync("echo test");
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// os tests : https://nodejs.org/api/os.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
module os_tests {
|
||||
{
|
||||
let result: string;
|
||||
|
||||
result = os.tmpdir();
|
||||
result = os.homedir();
|
||||
result = os.endianness();
|
||||
result = os.hostname();
|
||||
result = os.type();
|
||||
result = os.platform();
|
||||
result = os.arch();
|
||||
result = os.release();
|
||||
result = os.EOL;
|
||||
}
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = os.uptime();
|
||||
result = os.totalmem();
|
||||
result = os.freemem();
|
||||
}
|
||||
|
||||
{
|
||||
let result: number[];
|
||||
|
||||
result = os.loadavg();
|
||||
}
|
||||
|
||||
{
|
||||
let result: os.CpuInfo[];
|
||||
|
||||
result = os.cpus();
|
||||
}
|
||||
|
||||
{
|
||||
let result: {[index: string]: os.NetworkInterfaceInfo[]};
|
||||
|
||||
result = os.networkInterfaces();
|
||||
}
|
||||
}
|
||||
|
||||
26
node/node.d.ts
vendored
26
node/node.d.ts
vendored
@@ -698,7 +698,29 @@ declare module "zlib" {
|
||||
}
|
||||
|
||||
declare module "os" {
|
||||
export interface CpuInfo {
|
||||
model: string;
|
||||
speed: number;
|
||||
times: {
|
||||
user: number;
|
||||
nice: number;
|
||||
sys: number;
|
||||
idle: number;
|
||||
irq: number;
|
||||
}
|
||||
}
|
||||
|
||||
export interface NetworkInterfaceInfo {
|
||||
address: string;
|
||||
netmask: string;
|
||||
family: string;
|
||||
mac: string;
|
||||
internal: boolean;
|
||||
}
|
||||
|
||||
export function tmpdir(): string;
|
||||
export function homedir(): string;
|
||||
export function endianness(): string;
|
||||
export function hostname(): string;
|
||||
export function type(): string;
|
||||
export function platform(): string;
|
||||
@@ -708,8 +730,8 @@ declare module "os" {
|
||||
export function loadavg(): number[];
|
||||
export function totalmem(): number;
|
||||
export function freemem(): number;
|
||||
export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[];
|
||||
export function networkInterfaces(): any;
|
||||
export function cpus(): CpuInfo[];
|
||||
export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]};
|
||||
export var EOL: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user