From 70d92168820c378a8718e32e99415a1be79d1078 Mon Sep 17 00:00:00 2001 From: Gabriel Miranda Date: Fri, 29 Aug 2025 09:10:25 -0300 Subject: [PATCH 1/2] fix: links in js doc comments on rate limiting API --- src/interfaces.ts | 40 +++++++++++++++++++++------------------- src/rate-limiting.ts | 8 +++----- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/interfaces.ts b/src/interfaces.ts index 9b78f8fb..7ccef496 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -21,30 +21,32 @@ export const RESEND_ERROR_CODES_BY_KEY = { export type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY; +export type RateLimitExceededErrorResponse = { + message: string; + name: Extract; + /** + * Time in seconds. + */ + retryAfter: number; +}; + export type ErrorResponse = | { - message: string; - name: Exclude; - } - | { - message: string; - name: Extract; - /** - * Time in seconds. - */ - retryAfter: number; - }; + message: string; + name: Exclude; + } + | RateLimitExceededErrorResponse; export type Response = | { - data: Data; - rateLimiting: RateLimit; - error: null; - } + data: Data; + rateLimiting: RateLimit; + error: null; + } | { - data: null; - rateLimiting: RateLimit | null; - error: ErrorResponse; - }; + data: null; + rateLimiting: RateLimit | null; + error: ErrorResponse; + }; export type Tag = { name: string; value: string }; diff --git a/src/rate-limiting.ts b/src/rate-limiting.ts index 76994fb2..31ee1537 100644 --- a/src/rate-limiting.ts +++ b/src/rate-limiting.ts @@ -1,10 +1,8 @@ -// @ts-expect-error: this is used in the jsdoc for `shouldResetAfter` -// biome-ignore lint/correctness/noUnusedImports: this is used in the jsdoc for `shouldResetAfter` -import type { Response } from './interfaces'; +import type { RateLimitExceededErrorResponse } from './interfaces'; export type RateLimit = { /** - * The maximum amount of requests that can be made in the time window of {@link shouldResetAfter}. + * The maximum amount of requests that can be made in the time window of {@link RateLimit.shouldResetAfter}. */ limit: number; /** @@ -18,7 +16,7 @@ export type RateLimit = { * and {@link RateLimit.remainingRequests} goes back to the value of * {@link RateLimit.limit}. * - * @see {@link import('./interfaces').Response.retryAfter} + * @see {@link RateLimitExceededErrorResponse.retryAfter} */ shouldResetAfter: number; }; From cb62b6d8d9b8009e2c06542574a95f46816f3e5b Mon Sep 17 00:00:00 2001 From: Gabriel Miranda Date: Mon, 1 Sep 2025 09:44:15 -0300 Subject: [PATCH 2/2] lint --- src/interfaces.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/interfaces.ts b/src/interfaces.ts index 7ccef496..15861c5e 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -32,21 +32,21 @@ export type RateLimitExceededErrorResponse = { export type ErrorResponse = | { - message: string; - name: Exclude; - } + message: string; + name: Exclude; + } | RateLimitExceededErrorResponse; export type Response = | { - data: Data; - rateLimiting: RateLimit; - error: null; - } + data: Data; + rateLimiting: RateLimit; + error: null; + } | { - data: null; - rateLimiting: RateLimit | null; - error: ErrorResponse; - }; + data: null; + rateLimiting: RateLimit | null; + error: ErrorResponse; + }; export type Tag = { name: string; value: string };