diff --git a/deno/rest/v10/mod.ts b/deno/rest/v10/mod.ts index 61de424f..fab275b9 100644 --- a/deno/rest/v10/mod.ts +++ b/deno/rest/v10/mod.ts @@ -1054,8 +1054,8 @@ export const Routes = { }; for (const [key, fn] of Object.entries(Routes)) { - Routes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); }; @@ -1362,8 +1362,8 @@ export const CDNRoutes = { }; for (const [key, fn] of Object.entries(CDNRoutes)) { - CDNRoutes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); }; diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index 419307af..95d4e63c 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -1063,8 +1063,8 @@ export const Routes = { }; for (const [key, fn] of Object.entries(Routes)) { - Routes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); }; @@ -1371,8 +1371,8 @@ export const CDNRoutes = { }; for (const [key, fn] of Object.entries(CDNRoutes)) { - CDNRoutes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); }; diff --git a/rest/v10/index.ts b/rest/v10/index.ts index 06ce6328..5c7ce367 100644 --- a/rest/v10/index.ts +++ b/rest/v10/index.ts @@ -1054,8 +1054,8 @@ export const Routes = { }; for (const [key, fn] of Object.entries(Routes)) { - Routes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); }; @@ -1362,8 +1362,8 @@ export const CDNRoutes = { }; for (const [key, fn] of Object.entries(CDNRoutes)) { - CDNRoutes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); }; diff --git a/rest/v9/index.ts b/rest/v9/index.ts index b5376cf2..93a0bc3e 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -1063,8 +1063,8 @@ export const Routes = { }; for (const [key, fn] of Object.entries(Routes)) { - Routes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); }; @@ -1371,8 +1371,8 @@ export const CDNRoutes = { }; for (const [key, fn] of Object.entries(CDNRoutes)) { - CDNRoutes[key] = (...args: string[]) => { - const escaped = args.map((arg) => encodeURIComponent(arg)); + CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => { + const escaped = args.map((arg) => arg && encodeURIComponent(arg)); // eslint-disable-next-line no-useless-call return fn.call(null, ...escaped); };