@types/node
Advanced tools
+126
-178
@@ -20,11 +20,4 @@ export {}; // Make this a module | ||
| interface NodeDOMException extends Error { | ||
| /** | ||
| * @deprecated | ||
| * | ||
| * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) | ||
| */ | ||
| readonly code: number; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ | ||
| readonly message: string; | ||
| /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */ | ||
| readonly name: string; | ||
@@ -89,23 +82,2 @@ readonly INDEX_SIZE_ERR: 1; | ||
| declare global { | ||
| // Declare "static" methods in Error | ||
| interface ErrorConstructor { | ||
| /** Create .stack property on a target object */ | ||
| captureStackTrace(targetObject: object, constructorOpt?: Function): void; | ||
| /** | ||
| * Optional override for formatting stack traces | ||
| * | ||
| * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces | ||
| */ | ||
| prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; | ||
| stackTraceLimit: number; | ||
| } | ||
| /*-----------------------------------------------* | ||
| * * | ||
| * GLOBAL * | ||
| * * | ||
| ------------------------------------------------*/ | ||
| var global: typeof globalThis; | ||
@@ -116,167 +88,95 @@ | ||
| interface GCFunction { | ||
| (options: { | ||
| execution?: "sync"; | ||
| type?: "major" | "minor"; | ||
| }): void; | ||
| (options: { | ||
| execution: "async"; | ||
| type?: "major" | "minor"; | ||
| }): Promise<void>; | ||
| (options?: boolean): void; | ||
| } | ||
| /** | ||
| * Only available if `--expose-gc` is passed to the process. | ||
| */ | ||
| var gc: undefined | GCFunction; | ||
| // #region borrowed | ||
| // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib | ||
| /** A controller object that allows you to abort one or more DOM requests as and when desired. */ | ||
| interface AbortController { | ||
| interface ErrorConstructor { | ||
| /** | ||
| * Returns the AbortSignal object associated with this object. | ||
| * Creates a `.stack` property on `targetObject`, which when accessed returns | ||
| * a string representing the location in the code at which | ||
| * `Error.captureStackTrace()` was called. | ||
| * | ||
| * ```js | ||
| * const myObject = {}; | ||
| * Error.captureStackTrace(myObject); | ||
| * myObject.stack; // Similar to `new Error().stack` | ||
| * ``` | ||
| * | ||
| * The first line of the trace will be prefixed with | ||
| * `${myObject.name}: ${myObject.message}`. | ||
| * | ||
| * The optional `constructorOpt` argument accepts a function. If given, all frames | ||
| * above `constructorOpt`, including `constructorOpt`, will be omitted from the | ||
| * generated stack trace. | ||
| * | ||
| * The `constructorOpt` argument is useful for hiding implementation | ||
| * details of error generation from the user. For instance: | ||
| * | ||
| * ```js | ||
| * function a() { | ||
| * b(); | ||
| * } | ||
| * | ||
| * function b() { | ||
| * c(); | ||
| * } | ||
| * | ||
| * function c() { | ||
| * // Create an error without stack trace to avoid calculating the stack trace twice. | ||
| * const { stackTraceLimit } = Error; | ||
| * Error.stackTraceLimit = 0; | ||
| * const error = new Error(); | ||
| * Error.stackTraceLimit = stackTraceLimit; | ||
| * | ||
| * // Capture the stack trace above function b | ||
| * Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace | ||
| * throw error; | ||
| * } | ||
| * | ||
| * a(); | ||
| * ``` | ||
| */ | ||
| readonly signal: AbortSignal; | ||
| captureStackTrace(targetObject: object, constructorOpt?: Function): void; | ||
| /** | ||
| * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. | ||
| * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces | ||
| */ | ||
| abort(reason?: any): void; | ||
| } | ||
| /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ | ||
| interface AbortSignal extends EventTarget { | ||
| prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; | ||
| /** | ||
| * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. | ||
| * The `Error.stackTraceLimit` property specifies the number of stack frames | ||
| * collected by a stack trace (whether generated by `new Error().stack` or | ||
| * `Error.captureStackTrace(obj)`). | ||
| * | ||
| * The default value is `10` but may be set to any valid JavaScript number. Changes | ||
| * will affect any stack trace captured _after_ the value has been changed. | ||
| * | ||
| * If set to a non-number value, or set to a negative number, stack traces will | ||
| * not capture any frames. | ||
| */ | ||
| readonly aborted: boolean; | ||
| readonly reason: any; | ||
| onabort: null | ((this: AbortSignal, event: Event) => any); | ||
| throwIfAborted(): void; | ||
| stackTraceLimit: number; | ||
| } | ||
| var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T | ||
| : { | ||
| prototype: AbortController; | ||
| new(): AbortController; | ||
| }; | ||
| var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T | ||
| : { | ||
| prototype: AbortSignal; | ||
| new(): AbortSignal; | ||
| abort(reason?: any): AbortSignal; | ||
| timeout(milliseconds: number): AbortSignal; | ||
| any(signals: AbortSignal[]): AbortSignal; | ||
| }; | ||
| // #endregion borrowed | ||
| /** | ||
| * @since v17.0.0 | ||
| * | ||
| * Creates a deep clone of an object. | ||
| * Enable this API with the `--expose-gc` CLI flag. | ||
| */ | ||
| function structuredClone<T>( | ||
| value: T, | ||
| transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> }, | ||
| ): T; | ||
| var gc: NodeJS.GCFunction | undefined; | ||
| // #region DOMException | ||
| /** | ||
| * @since v17.0.0 | ||
| * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. | ||
| * | ||
| * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) | ||
| */ | ||
| interface DOMException extends _DOMException {} | ||
| /** | ||
| * @since v17.0.0 | ||
| * | ||
| * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details. | ||
| */ | ||
| var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T | ||
| : NodeDOMExceptionConstructor; | ||
| // #endregion DOMException | ||
| /*----------------------------------------------* | ||
| * * | ||
| * GLOBAL INTERFACES * | ||
| * * | ||
| *-----------------------------------------------*/ | ||
| namespace NodeJS { | ||
| interface CallSite { | ||
| /** | ||
| * Value of "this" | ||
| */ | ||
| getThis(): unknown; | ||
| /** | ||
| * Type of "this" as a string. | ||
| * This is the name of the function stored in the constructor field of | ||
| * "this", if available. Otherwise the object's [[Class]] internal | ||
| * property. | ||
| */ | ||
| getTypeName(): string | null; | ||
| /** | ||
| * Current function | ||
| */ | ||
| getColumnNumber(): number | null; | ||
| getEnclosingColumnNumber(): number | null; | ||
| getEnclosingLineNumber(): number | null; | ||
| getEvalOrigin(): string | undefined; | ||
| getFileName(): string | null; | ||
| getFunction(): Function | undefined; | ||
| /** | ||
| * Name of the current function, typically its name property. | ||
| * If a name property is not available an attempt will be made to try | ||
| * to infer a name from the function's context. | ||
| */ | ||
| getFunctionName(): string | null; | ||
| /** | ||
| * Name of the property [of "this" or one of its prototypes] that holds | ||
| * the current function | ||
| */ | ||
| getLineNumber(): number | null; | ||
| getMethodName(): string | null; | ||
| /** | ||
| * Name of the script [if this function was defined in a script] | ||
| */ | ||
| getFileName(): string | undefined; | ||
| /** | ||
| * Current line number [if this function was defined in a script] | ||
| */ | ||
| getLineNumber(): number | null; | ||
| /** | ||
| * Current column number [if this function was defined in a script] | ||
| */ | ||
| getColumnNumber(): number | null; | ||
| /** | ||
| * A call site object representing the location where eval was called | ||
| * [if this function was created using a call to eval] | ||
| */ | ||
| getEvalOrigin(): string | undefined; | ||
| /** | ||
| * Is this a toplevel invocation, that is, is "this" the global object? | ||
| */ | ||
| isToplevel(): boolean; | ||
| /** | ||
| * Does this call take place in code defined by a call to eval? | ||
| */ | ||
| getPosition(): number; | ||
| getPromiseIndex(): number | null; | ||
| getScriptHash(): string; | ||
| getScriptNameOrSourceURL(): string | null; | ||
| getThis(): unknown; | ||
| getTypeName(): string | null; | ||
| isAsync(): boolean; | ||
| isConstructor(): boolean; | ||
| isEval(): boolean; | ||
| /** | ||
| * Is this call in native V8 code? | ||
| */ | ||
| isNative(): boolean; | ||
| /** | ||
| * Is this a constructor call? | ||
| */ | ||
| isConstructor(): boolean; | ||
| isPromiseAll(): boolean; | ||
| isToplevel(): boolean; | ||
| } | ||
@@ -329,2 +229,13 @@ | ||
| interface GCFunction { | ||
| (minor?: boolean): void; | ||
| (options: NodeJS.GCOptions & { execution: "async" }): Promise<void>; | ||
| (options: NodeJS.GCOptions): void; | ||
| } | ||
| interface GCOptions { | ||
| execution?: "sync" | "async" | undefined; | ||
| type?: "major" | "minor" | undefined; | ||
| } | ||
| /** An iterable iterator returned by the Node.js API. */ | ||
@@ -343,2 +254,41 @@ // Default TReturn/TNext in v18 is `any`, for compatibility with the previously-used IterableIterator. | ||
| // Global DOM types | ||
| function structuredClone<T>( | ||
| value: T, | ||
| transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> }, | ||
| ): T; | ||
| interface DOMException extends _DOMException {} | ||
| var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T | ||
| : NodeDOMExceptionConstructor; | ||
| // #region AbortController | ||
| interface AbortController { | ||
| readonly signal: AbortSignal; | ||
| abort(reason?: any): void; | ||
| } | ||
| var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T | ||
| : { | ||
| prototype: AbortController; | ||
| new(): AbortController; | ||
| }; | ||
| interface AbortSignal extends EventTarget { | ||
| readonly aborted: boolean; | ||
| onabort: ((this: AbortSignal, ev: Event) => any) | null; | ||
| readonly reason: any; | ||
| throwIfAborted(): void; | ||
| } | ||
| var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T | ||
| : { | ||
| prototype: AbortSignal; | ||
| new(): AbortSignal; | ||
| abort(reason?: any): AbortSignal; | ||
| any(signals: AbortSignal[]): AbortSignal; | ||
| timeout(milliseconds: number): AbortSignal; | ||
| }; | ||
| // #endregion AbortController | ||
| // #region fetch | ||
| interface RequestInit extends _RequestInit {} | ||
@@ -382,5 +332,2 @@ | ||
| interface MessageEvent extends _MessageEvent {} | ||
| /** | ||
| * @since v15.0.0 | ||
| */ | ||
| var MessageEvent: typeof globalThis extends { | ||
@@ -391,2 +338,3 @@ onmessage: any; | ||
| : typeof import("undici-types").MessageEvent; | ||
| // #endregion fetch | ||
| } |
| { | ||
| "name": "@types/node", | ||
| "version": "18.19.92", | ||
| "version": "18.19.93", | ||
| "description": "TypeScript definitions for node", | ||
@@ -223,4 +223,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
| "peerDependencies": {}, | ||
| "typesPublisherContentHash": "ac804d6fc76633acbe050d4cee6afb333118333c08548d5e6beb766a881cee8d", | ||
| "typesPublisherContentHash": "837c25fd51b2953454eefd586d4fa92a142c155c99655b74e76616e39d39c541", | ||
| "typeScriptVersion": "5.1" | ||
| } |
@@ -11,3 +11,3 @@ # Installation | ||
| ### Additional Details | ||
| * Last updated: Mon, 05 May 2025 21:33:58 GMT | ||
| * Last updated: Mon, 05 May 2025 23:02:37 GMT | ||
| * Dependencies: [undici-types](https://npmjs.com/package/undici-types) | ||
@@ -14,0 +14,0 @@ |
Network access
Supply chain riskThis module accesses the network.
Found 9 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 10 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 9 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 10 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
335
-0.3%2066142
-0.07%46213
-0.08%35
6.06%