Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference lib="es2020" />
/// <reference lib="es2023" />
/// <reference path="./globals.d.ts" />
/// <reference path="./os.d.ts" />
/// <reference path="./std.d.ts" />
31 changes: 21 additions & 10 deletions os.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ declare module "os" {
}

export const SIGINT: 2;
export const SIGABRT: 6;
export const SIGABRT: 22;
export const SIGFPE: 8;
export const SIGILL: 4;
export const SIGSEGV: 11;
Expand All @@ -76,19 +76,28 @@ declare module "os" {
export const O_RDONLY: 0;
export const O_WRONLY: 1;
export const O_RDWR: 2;
export const O_CREAT: 64;
export const O_EXCL: 128;
export const O_CREAT: 256;
export const O_EXCL: 1024;
export const O_TRUNC: 512;
export const O_APPEND: 1024;
export const O_APPEND: 8;
export const O_TEXT: 16384;
export const O_BINARY: 32768;

export function open(filename: string, flag: number, mode?: unknown): File | -1;
export const S_IFMT: 61440;
export const S_IFIFO: 4096;
export const S_IFCHR: 8192;
export const S_IFDIR: 16384;
export const S_IFBLK: 24576;
export const S_IFREG: 32768;

export function open(
filename: string,
flag: number,
mode?: unknown
): File | -1;
export function close(file: File): number;
export function seek(file: File, offset: number, whence: Seek): number;
export function seek(
file: File,
offset: BigInt,
whence: Seek
): BigInt;
export function seek(file: File, offset: BigInt, whence: Seek): BigInt;
export function read(
file: File,
buffer: ArrayBuffer,
Expand Down Expand Up @@ -139,6 +148,8 @@ declare module "os" {
export function dup2(oldFile: File, newFile: File): void;
export function pipe(): [readFile: File, writeFile: File] | null;
export function sleep(delay: number): void;
export function sleepAsync(delay: number): Promise<void>;
export function setTimeout(cb: Callback, delay: number): TimeoutHandle;
export function clearTimeout(handle: TimeoutHandle): void;
export function now(): number;
}
15 changes: 9 additions & 6 deletions std.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
declare module "std" {
import { File } from "os";

export interface EvalOptions {
backtrace_barrier?: boolean;
}

export interface ErrorOptions {
errorno: Error;
}
Expand Down Expand Up @@ -50,7 +46,14 @@ declare module "std" {
}

export function exit(n: number): void;
export function evalScript(script: string, options?: EvalOptions): void;
export function evalScript(
script: string,
options?: { backtrace_barrier?: boolean; async?: false }
): any;
export function evalScript(
script: string,
options?: { backtrace_barrier?: boolean; async?: true }
): Promise<{ value: any }>;
export function loadScript(filename: string): void;
export function loadFile(filename: string): void;
export function open(
Expand All @@ -75,7 +78,7 @@ declare module "std" {

export function strerror(errorno: Error): string;
export function gc(): void;
export function getenv(name: string): any | undefined;
export function getenv(name: string): string | undefined;
export function setenv(name: string, value: any): void;
export function unsetenv(name: string): void;
export function getenviron(): { readonly [key: string]: string };
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"lib": ["ES2020"],
"target": "es2023",
"module": "esnext",
"lib": ["ES2023"],
"noEmit": true,
"strict": true,
"noImplicitAny": true,
Expand Down