Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6d8800

Browse files
committed
Add typing
1 parent cf7d362 commit e6d8800

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

types/globals.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export {};
2+
declare global {
3+
namespace QuickJS {
4+
type Platform = "darwin" | "linux" | "win32";
5+
}
6+
}

types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference path="console.d.ts" />
2+
/// <reference path="os.d.ts" />
23
/// <reference path="sqlite.d.ts" />
34
/// <reference path="timers.d.ts" />
45
/// <reference path="url.d.ts" />

types/os.d.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
declare module "os" {
2+
/**
3+
* Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
4+
* returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
5+
*
6+
* See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information
7+
* about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems.
8+
*/
9+
export function type(): string;
10+
11+
/**
12+
* Returns the operating system release as a string.
13+
*
14+
* On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used. See
15+
* [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
16+
*/
17+
export function release(): string;
18+
19+
/**
20+
* Returns a string identifying the kernel version.
21+
*
22+
* On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used.
23+
* See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
24+
*/
25+
export function version(): string;
26+
27+
/**
28+
* Returns the string path of the current user's home directory.
29+
*
30+
* On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it
31+
* uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory.
32+
*
33+
* On Windows, it uses the `USERPROFILE` environment variable if defined.
34+
* Otherwise it uses the path to the profile directory of the current user.
35+
*/
36+
export function homedir(): string;
37+
38+
/**
39+
* Returns a string identifying the operating system platform for which
40+
* the Node.js binary was compiled. The value is set at compile time.
41+
*/
42+
export function platform(): QuickJS.Platform;
43+
44+
/**
45+
* Returns the operating system's default directory for temporary files as a
46+
* string.
47+
*/
48+
export function tmpdir(): string;
49+
50+
/**
51+
* The operating system-specific end-of-line marker.
52+
* * `\n` on POSIX
53+
* * `\r\n` on Windows
54+
*/
55+
const EOL: string;
56+
57+
/**
58+
* Returns the operating system CPU architecture for which the LLRT binary was compiled.
59+
* Possible values are 'arm64', 'x64'. The return value is equivalent to `process.arch`.
60+
*/
61+
export function arch(): string;
62+
}

0 commit comments

Comments
 (0)