mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix: Fix incompatibility with latest @types/node (#23307)
This commit is contained in:
76
packages/bun-types/globals.d.ts
vendored
76
packages/bun-types/globals.d.ts
vendored
@@ -7,6 +7,13 @@ declare module "bun" {
|
||||
type LibWorkerOrBunWorker = LibDomIsLoaded extends true ? {} : Bun.Worker;
|
||||
type LibEmptyOrBunWebSocket = LibDomIsLoaded extends true ? {} : Bun.WebSocket;
|
||||
|
||||
type LibEmptyOrNodeStreamWebCompressionStream = LibDomIsLoaded extends true
|
||||
? {}
|
||||
: import("node:stream/web").CompressionStream;
|
||||
type LibEmptyOrNodeStreamWebDecompressionStream = LibDomIsLoaded extends true
|
||||
? {}
|
||||
: import("node:stream/web").DecompressionStream;
|
||||
|
||||
type LibPerformanceOrNodePerfHooksPerformance = LibDomIsLoaded extends true ? {} : import("perf_hooks").Performance;
|
||||
type LibEmptyOrPerformanceEntry = LibDomIsLoaded extends true ? {} : import("node:perf_hooks").PerformanceEntry;
|
||||
type LibEmptyOrPerformanceMark = LibDomIsLoaded extends true ? {} : import("node:perf_hooks").PerformanceMark;
|
||||
@@ -271,6 +278,30 @@ declare var Event: {
|
||||
new (type: string, eventInitDict?: Bun.EventInit): Event;
|
||||
};
|
||||
|
||||
/**
|
||||
* Unimplemented in Bun
|
||||
*/
|
||||
interface CompressionStream extends Bun.__internal.LibEmptyOrNodeStreamWebCompressionStream {}
|
||||
/**
|
||||
* Unimplemented in Bun
|
||||
*/
|
||||
declare var CompressionStream: Bun.__internal.UseLibDomIfAvailable<
|
||||
"CompressionStream",
|
||||
typeof import("node:stream/web").CompressionStream
|
||||
>;
|
||||
|
||||
/**
|
||||
* Unimplemented in Bun
|
||||
*/
|
||||
interface DecompressionStream extends Bun.__internal.LibEmptyOrNodeStreamWebCompressionStream {}
|
||||
/**
|
||||
* Unimplemented in Bun
|
||||
*/
|
||||
declare var DecompressionStream: Bun.__internal.UseLibDomIfAvailable<
|
||||
"DecompressionStream",
|
||||
typeof import("node:stream/web").DecompressionStream
|
||||
>;
|
||||
|
||||
interface EventTarget {
|
||||
/**
|
||||
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
|
||||
@@ -860,7 +891,10 @@ interface ErrnoException extends Error {
|
||||
syscall?: string | undefined;
|
||||
}
|
||||
|
||||
/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
|
||||
/**
|
||||
* An abnormal event (called an exception) which occurs as a result of calling a
|
||||
* method or accessing a property of a web API
|
||||
*/
|
||||
interface DOMException extends Error {
|
||||
readonly message: string;
|
||||
readonly name: string;
|
||||
@@ -890,11 +924,35 @@ interface DOMException extends Error {
|
||||
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||
readonly DATA_CLONE_ERR: 25;
|
||||
}
|
||||
|
||||
// declare var DOMException: {
|
||||
// prototype: DOMException;
|
||||
// new (message?: string, name?: string): DOMException;
|
||||
// };
|
||||
declare var DOMException: {
|
||||
prototype: DOMException;
|
||||
new (message?: string, name?: string): DOMException;
|
||||
readonly INDEX_SIZE_ERR: 1;
|
||||
readonly DOMSTRING_SIZE_ERR: 2;
|
||||
readonly HIERARCHY_REQUEST_ERR: 3;
|
||||
readonly WRONG_DOCUMENT_ERR: 4;
|
||||
readonly INVALID_CHARACTER_ERR: 5;
|
||||
readonly NO_DATA_ALLOWED_ERR: 6;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
||||
readonly NOT_FOUND_ERR: 8;
|
||||
readonly NOT_SUPPORTED_ERR: 9;
|
||||
readonly INUSE_ATTRIBUTE_ERR: 10;
|
||||
readonly INVALID_STATE_ERR: 11;
|
||||
readonly SYNTAX_ERR: 12;
|
||||
readonly INVALID_MODIFICATION_ERR: 13;
|
||||
readonly NAMESPACE_ERR: 14;
|
||||
readonly INVALID_ACCESS_ERR: 15;
|
||||
readonly VALIDATION_ERR: 16;
|
||||
readonly TYPE_MISMATCH_ERR: 17;
|
||||
readonly SECURITY_ERR: 18;
|
||||
readonly NETWORK_ERR: 19;
|
||||
readonly ABORT_ERR: 20;
|
||||
readonly URL_MISMATCH_ERR: 21;
|
||||
readonly QUOTA_EXCEEDED_ERR: 22;
|
||||
readonly TIMEOUT_ERR: 23;
|
||||
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||
readonly DATA_CLONE_ERR: 25;
|
||||
};
|
||||
|
||||
declare function alert(message?: string): void;
|
||||
declare function confirm(message?: string): boolean;
|
||||
@@ -1605,12 +1663,6 @@ declare var AbortSignal: Bun.__internal.UseLibDomIfAvailable<
|
||||
}
|
||||
>;
|
||||
|
||||
interface DOMException {}
|
||||
declare var DOMException: Bun.__internal.UseLibDomIfAvailable<
|
||||
"DOMException",
|
||||
{ prototype: DOMException; new (): DOMException }
|
||||
>;
|
||||
|
||||
interface FormData {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
|
||||
append(name: string, value: string | Blob): void;
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
"node-gyp": "10.0.1",
|
||||
"nodemailer": "6.9.3",
|
||||
"p-queue": "8.1.0",
|
||||
"peechy": "^0.4.310",
|
||||
"peechy": "0.4.310",
|
||||
"pg": "8.11.1",
|
||||
"pg-connection-string": "2.6.1",
|
||||
"pg-gateway": "0.3.0-beta.4",
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import * as nodeCrypto from "crypto";
|
||||
import { expectType } from "./utilities";
|
||||
|
||||
nodeCrypto.webcrypto.CryptoKey;
|
||||
|
||||
crypto.getRandomValues(new Uint8Array(1));
|
||||
|
||||
// TODO(@alii): Failing with @types/node@22.15.0
|
||||
|
||||
Reference in New Issue
Block a user