mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
feat: update @types/node to v22 (#10926)
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
import { Blob } from 'node:buffer';
|
||||
import { shouldUseGlobalFetchAndWebSocket } from '@discordjs/util';
|
||||
import { FormData } from 'undici';
|
||||
import { setDefaultStrategy } from './environment.js';
|
||||
import { makeRequest } from './strategies/undiciRequest.js';
|
||||
|
||||
// TODO(ckohen): remove once node engine req is bumped to > v18
|
||||
(globalThis as any).FormData ??= FormData;
|
||||
globalThis.Blob ??= Blob;
|
||||
|
||||
setDefaultStrategy(shouldUseGlobalFetchAndWebSocket() ? fetch : makeRequest);
|
||||
// This cast is needed because of a mismatch between the version of undici-types provided by @types/node and undici
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
setDefaultStrategy(shouldUseGlobalFetchAndWebSocket() ? (fetch as typeof import('undici').fetch) : makeRequest);
|
||||
|
||||
export * from './shared.js';
|
||||
|
||||
@@ -70,9 +70,9 @@ export class REST extends AsyncEventEmitter<RestEvents> {
|
||||
|
||||
#token: string | null = null;
|
||||
|
||||
private hashTimer!: NodeJS.Timer | number;
|
||||
private hashTimer!: NodeJS.Timeout | number;
|
||||
|
||||
private handlerTimer!: NodeJS.Timer | number;
|
||||
private handlerTimer!: NodeJS.Timeout | number;
|
||||
|
||||
public readonly options: RESTOptions;
|
||||
|
||||
|
||||
5
packages/rest/src/lib/global/fetch.d.ts
vendored
5
packages/rest/src/lib/global/fetch.d.ts
vendored
@@ -1,5 +0,0 @@
|
||||
import type * as undici from 'undici';
|
||||
|
||||
declare global {
|
||||
export const { fetch, FormData, Headers, Request, Response }: typeof undici;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { setDefaultStrategy } from './environment.js';
|
||||
|
||||
setDefaultStrategy(fetch);
|
||||
// This cast is needed because of a mismatch between the version of undici-types provided by @types/node and undici
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
setDefaultStrategy(fetch as typeof import('undici').fetch);
|
||||
|
||||
export * from './shared.js';
|
||||
|
||||
Reference in New Issue
Block a user