Skip to content
Merged
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
5 changes: 5 additions & 0 deletions types/node/assert.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
declare module 'node:assert' {
import assert = require('assert');
export = assert;
}

declare module 'assert' {
/** An alias of `assert.ok()`. */
function assert(value: any, message?: string | Error): asserts value;
Expand Down
9 changes: 8 additions & 1 deletion types/node/async_hooks.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
/**
* Async Hooks module: https://nodejs.org/api/async_hooks.html
*/
declare module "async_hooks" {
declare module 'node:async_hooks' {
export * from 'async_hooks';
}

/**
* Async Hooks module: https://nodejs.org/api/async_hooks.html
*/
declare module 'async_hooks' {
/**
* Returns the asyncId of the current execution context.
*/
Expand Down
6 changes: 5 additions & 1 deletion types/node/buffer.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
declare module "buffer" {
declare module 'node:buffer' {
export * from 'buffer';
}

declare module 'buffer' {
export const INSPECT_MAX_BYTES: number;
export const kMaxLength: number;
export const kStringMaxLength: number;
Expand Down
14 changes: 9 additions & 5 deletions types/node/child_process.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
declare module "child_process" {
import { BaseEncodingOptions } from 'fs';
import * as events from "events";
import * as net from "net";
import { Writable, Readable, Stream, Pipe } from "stream";
declare module 'node:child_process' {
export * from 'child_process';
}

declare module 'child_process' {
import { BaseEncodingOptions } from 'node:fs';
import * as events from 'node:events';
import * as net from 'node:net';
import { Writable, Readable, Stream, Pipe } from 'node:stream';

type Serializable = string | object | number | boolean;
type SendHandle = net.Socket | net.Server;
Expand Down
16 changes: 10 additions & 6 deletions types/node/cluster.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
declare module "cluster" {
import * as child from "child_process";
import * as events from "events";
import * as net from "net";
declare module 'node:cluster' {
export * from 'cluster';
}

declare module 'cluster' {
import * as child from 'node:child_process';
import EventEmitter = require('node:events');
import * as net from 'node:net';

// interfaces
interface ClusterSettings {
Expand All @@ -21,7 +25,7 @@ declare module "cluster" {
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
}

class Worker extends events.EventEmitter {
class Worker extends EventEmitter {
id: number;
process: child.ChildProcess;
send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean;
Expand Down Expand Up @@ -90,7 +94,7 @@ declare module "cluster" {
prependOnceListener(event: "online", listener: () => void): this;
}

interface Cluster extends events.EventEmitter {
interface Cluster extends EventEmitter {
Worker: Worker;
disconnect(callback?: () => void): void;
fork(env?: any): Worker;
Expand Down
8 changes: 6 additions & 2 deletions types/node/console.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
declare module "console" {
import { InspectOptions } from 'util';
declare module 'node:console' {
export = console;
}

declare module 'console' {
import { InspectOptions } from 'node:util';

global {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
Expand Down
21 changes: 16 additions & 5 deletions types/node/constants.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
declare module "constants" {
import { constants as osConstants, SignalConstants } from 'os';
import { constants as cryptoConstants } from 'crypto';
import { constants as fsConstants } from 'fs';
const exp: typeof osConstants.errno & typeof osConstants.priority & SignalConstants & typeof cryptoConstants & typeof fsConstants;
declare module 'node:constants' {
import exp = require('constants');
export = exp;
}

/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
declare module 'constants' {
import { constants as osConstants, SignalConstants } from 'node:os';
import { constants as cryptoConstants } from 'node:crypto';
import { constants as fsConstants } from 'node:fs';

const exp: typeof osConstants.errno &
typeof osConstants.priority &
SignalConstants &
typeof cryptoConstants &
typeof fsConstants;
export = exp;
}
6 changes: 5 additions & 1 deletion types/node/crypto.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
declare module 'node:crypto' {
export * from 'crypto';
}

declare module 'crypto' {
import * as stream from 'stream';
import * as stream from 'node:stream';

interface Certificate {
/**
Expand Down
14 changes: 9 additions & 5 deletions types/node/dgram.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
declare module "dgram" {
import { AddressInfo } from "net";
import * as dns from "dns";
import * as events from "events";
declare module 'node:dgram' {
export * from 'dgram';
}

declare module 'dgram' {
import { AddressInfo } from 'node:net';
import * as dns from 'node:dns';
import EventEmitter = require('node:events');

interface RemoteInfo {
address: string;
Expand Down Expand Up @@ -34,7 +38,7 @@ declare module "dgram" {
function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;

class Socket extends events.EventEmitter {
class Socket extends EventEmitter {
addMembership(multicastAddress: string, multicastInterface?: string): void;
address(): AddressInfo;
bind(port?: number, address?: string, callback?: () => void): void;
Expand Down
6 changes: 5 additions & 1 deletion types/node/dns.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
declare module "dns" {
declare module 'node:dns' {
export * from 'dns';
}

declare module 'dns' {
// Supported getaddrinfo flags.
const ADDRCONFIG: number;
const V4MAPPED: number;
Expand Down
6 changes: 5 additions & 1 deletion types/node/domain.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
declare module 'node:domain' {
export * from 'domain';
}

declare module 'domain' {
import EventEmitter = require('events');
import EventEmitter = require('node:events');

global {
namespace NodeJS {
Expand Down
5 changes: 5 additions & 0 deletions types/node/events.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
declare module 'node:events' {
import EventEmitter = require('events');
export = EventEmitter;
}

declare module 'events' {
interface EventEmitterOptions {
/**
Expand Down
16 changes: 10 additions & 6 deletions types/node/fs.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
declare module "fs" {
import * as stream from "stream";
import * as events from "events";
import { URL } from "url";
import * as promises from 'fs/promises';
declare module 'node:fs' {
export * from 'fs';
}

declare module 'fs' {
import * as stream from 'node:stream';
import EventEmitter = require('node:events');
import { URL } from 'node:url';
import * as promises from 'node:fs/promises';

export { promises };
/**
Expand Down Expand Up @@ -108,7 +112,7 @@ declare module "fs" {
readSync(): Dirent | null;
}

export interface FSWatcher extends events.EventEmitter {
export interface FSWatcher extends EventEmitter {
close(): void;

/**
Expand Down
6 changes: 5 additions & 1 deletion types/node/fs/promises.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
declare module 'fs/promises' {
export * from 'node:fs/promises';
}

declare module 'node:fs/promises' {
import {
Stats,
WriteVResult,
Expand All @@ -14,7 +18,7 @@ declare module 'fs/promises' {
BufferEncodingOption,
OpenMode,
Mode,
} from 'fs';
} from 'node:fs';

interface FileHandle {
/**
Expand Down
12 changes: 8 additions & 4 deletions types/node/http.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
declare module "http" {
import * as stream from "stream";
import { URL } from "url";
import { Socket, Server as NetServer } from "net";
declare module 'node:http' {
export * from 'http';
}

declare module 'http' {
import * as stream from 'node:stream';
import { URL } from 'node:url';
import { Socket, Server as NetServer } from 'node:net';

// incoming headers will never contain number
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
Expand Down
29 changes: 19 additions & 10 deletions types/node/http2.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
declare module "http2" {
import * as events from "events";
import * as fs from "fs";
import * as net from "net";
import * as stream from "stream";
import * as tls from "tls";
import * as url from "url";
declare module 'node:http2' {
export * from 'http2';
}

import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from "http";
export { OutgoingHttpHeaders } from "http";
declare module 'http2' {
import EventEmitter = require('node:events');
import * as fs from 'node:fs';
import * as net from 'node:net';
import * as stream from 'node:stream';
import * as tls from 'node:tls';
import * as url from 'node:url';

import {
IncomingHttpHeaders as Http1IncomingHttpHeaders,
OutgoingHttpHeaders,
IncomingMessage,
ServerResponse,
} from 'node:http';
export { OutgoingHttpHeaders } from 'node:http';

export interface IncomingHttpStatusHeader {
":status"?: number;
Expand Down Expand Up @@ -261,7 +270,7 @@ declare module "http2" {
inflateDynamicTableSize?: number;
}

export interface Http2Session extends events.EventEmitter {
export interface Http2Session extends EventEmitter {
readonly alpnProtocol?: string;
readonly closed: boolean;
readonly connecting: boolean;
Expand Down
13 changes: 8 additions & 5 deletions types/node/https.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
declare module "https" {
import * as tls from "tls";
import * as events from "events";
import * as http from "http";
import { URL } from "url";
declare module 'node:https' {
export * from 'https';
}

declare module 'https' {
import * as tls from 'node:tls';
import * as http from 'node:http';
import { URL } from 'node:url';

type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;

Expand Down
11 changes: 9 additions & 2 deletions types/node/inspector.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
/**
* The inspector module provides an API for interacting with the V8 inspector.
*/
declare module "inspector" {
import { EventEmitter } from 'events';
declare module 'node:inspector' {
export * from 'inspector';
}

/**
* The inspector module provides an API for interacting with the V8 inspector.
*/
declare module 'inspector' {
import EventEmitter = require('node:events');

interface InspectorNotification<T> {
method: string;
Expand Down
9 changes: 7 additions & 2 deletions types/node/module.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
declare module "module" {
import { URL } from "url";
declare module 'node:module' {
import Module = require('module');
export = Module;
}

declare module 'module' {
import { URL } from 'node:url';
namespace Module {
/**
* Updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports.
Expand Down
20 changes: 14 additions & 6 deletions types/node/net.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
declare module "net" {
import * as stream from "stream";
import * as events from "events";
import * as dns from "dns";
declare module 'node:net' {
export * from 'net';
}

declare module 'net' {
import * as stream from 'node:stream';
import EventEmitter = require('node:events');
import * as dns from 'node:dns';

type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
type LookupFunction = (
hostname: string,
options: dns.LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
) => void;

interface AddressInfo {
address: string;
Expand Down Expand Up @@ -191,7 +199,7 @@ declare module "net" {
}

// https://github.com/nodejs/node/blob/master/lib/net.js
class Server extends events.EventEmitter {
class Server extends EventEmitter {
constructor(connectionListener?: (socket: Socket) => void);
constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);

Expand Down
2 changes: 1 addition & 1 deletion types/node/node-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './test/buffer';
import './test/querystring';
import './test/url';

import * as assert from 'assert';
import assert = require('node:assert');

assert(true, "it's working");

Expand Down
6 changes: 5 additions & 1 deletion types/node/os.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
declare module "os" {
declare module 'node:os' {
export * from 'os';
}

declare module 'os' {
interface CpuInfo {
model: string;
speed: number;
Expand Down
Loading