Skip to content

feat: update @types/node to v22 #10926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2025
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
4 changes: 2 additions & 2 deletions packages/rest/__tests__/RequestHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ let serverOutage = true;
let unexpected429 = true;
let unexpected429cf = true;
const sublimitIntervals: {
reset: NodeJS.Timer | null;
retry: NodeJS.Timer | null;
reset: NodeJS.Timeout | null;
retry: NodeJS.Timeout | null;
} = {
reset: null,
retry: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@discordjs/api-extractor": "workspace:^",
"@discordjs/scripts": "workspace:^",
"@favware/cliff-jumper": "^4.1.0",
"@types/node": "18.17.9",
"@types/node": "^22.15.2",
"@vitest/coverage-v8": "^3.1.1",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.1",
Expand Down
10 changes: 3 additions & 7 deletions packages/rest/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
4 changes: 2 additions & 2 deletions packages/rest/src/lib/REST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 0 additions & 5 deletions packages/rest/src/lib/global/fetch.d.ts

This file was deleted.

4 changes: 3 additions & 1 deletion packages/rest/src/web.ts
Original file line number Diff line number Diff line change
@@ -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';
203 changes: 6 additions & 197 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.