From 5b9724a3734c5fa08c1a18c2233cd6d1ca915abd Mon Sep 17 00:00:00 2001 From: Linda_pp Date: Mon, 23 Jan 2017 14:11:34 +0900 Subject: [PATCH] node: strict platform value (#14134) * node: strict platform value From: https://nodejs.org/api/os.html#os_os_platform > Currently possible values are: > > - 'aix' > - 'darwin' > - 'freebsd' > - 'linux' > - 'openbsd' > - 'sunos' > - 'win32' > > Equivalent to process.platform. * node: add missing 'android' to platforms * node: improve platform strings also in v7 --- node/index.d.ts | 13 +++++++++++-- node/node-tests.ts | 1 - node/v6/index.d.ts | 13 +++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/node/index.d.ts b/node/index.d.ts index 1f32030db7..32d3f5a203 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -347,6 +347,15 @@ declare namespace NodeJS { openssl: string; } + type Platform = 'aix' + | 'android' + | 'darwin' + | 'freebsd' + | 'linux' + | 'openbsd' + | 'sunos' + | 'win32'; + export interface Process extends EventEmitter { stdout: WritableStream; stderr: WritableStream; @@ -399,7 +408,7 @@ declare namespace NodeJS { pid: number; title: string; arch: string; - platform: string; + platform: Platform; mainModule?: NodeModule; memoryUsage(): MemoryUsage; cpuUsage(previousValue?: CpuUsage): CpuUsage; @@ -1311,7 +1320,7 @@ declare module "os" { }, }; export function arch(): string; - export function platform(): string; + export function platform(): NodeJS.Platform; export function tmpdir(): string; export var EOL: string; export function endianness(): "BE" | "LE"; diff --git a/node/node-tests.ts b/node/node-tests.ts index adcadb1a60..2844ca8e6e 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -1481,7 +1481,6 @@ namespace os_tests { result = os.endianness(); result = os.hostname(); result = os.type(); - result = os.platform(); result = os.arch(); result = os.release(); result = os.EOL; diff --git a/node/v6/index.d.ts b/node/v6/index.d.ts index ba3a7685fc..ed07d1cad1 100644 --- a/node/v6/index.d.ts +++ b/node/v6/index.d.ts @@ -347,6 +347,15 @@ declare namespace NodeJS { openssl: string; } + type Platform = 'aix' + | 'android' + | 'darwin' + | 'freebsd' + | 'linux' + | 'openbsd' + | 'sunos' + | 'win32'; + export interface Process extends EventEmitter { stdout: WritableStream; stderr: WritableStream; @@ -399,7 +408,7 @@ declare namespace NodeJS { pid: number; title: string; arch: string; - platform: string; + platform: Platform; mainModule?: NodeModule; memoryUsage(): MemoryUsage; cpuUsage(previousValue?: CpuUsage): CpuUsage; @@ -1262,7 +1271,7 @@ declare module "os" { }, }; export function arch(): string; - export function platform(): string; + export function platform(): NodeJS.Platform; export function tmpdir(): string; export var EOL: string; export function endianness(): "BE" | "LE";