feat: update @types/node to v22 (#10926)

This commit is contained in:
Almeida
2025-06-07 14:21:57 +01:00
committed by GitHub
parent 9708717204
commit 8e03af6eaf
7 changed files with 17 additions and 215 deletions

View File

@@ -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';