Skip to content

Commit b0055c4

Browse files
authored
fix: links in js doc comments on rate limiting API (#612)
1 parent 16f6884 commit b0055c4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/interfaces.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@ export const RESEND_ERROR_CODES_BY_KEY = {
2121

2222
export type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
2323

24+
export type RateLimitExceededErrorResponse = {
25+
message: string;
26+
name: Extract<RESEND_ERROR_CODE_KEY, 'rate_limit_exceeded'>;
27+
/**
28+
* Time in seconds.
29+
*/
30+
retryAfter: number;
31+
};
32+
2433
export type ErrorResponse =
2534
| {
2635
message: string;
2736
name: Exclude<RESEND_ERROR_CODE_KEY, 'rate_limit_exceeded'>;
2837
}
29-
| {
30-
message: string;
31-
name: Extract<RESEND_ERROR_CODE_KEY, 'rate_limit_exceeded'>;
32-
/**
33-
* Time in seconds.
34-
*/
35-
retryAfter: number;
36-
};
38+
| RateLimitExceededErrorResponse;
3739

3840
export type Response<Data> =
3941
| {

src/rate-limiting.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
// @ts-expect-error: this is used in the jsdoc for `shouldResetAfter`
2-
// biome-ignore lint/correctness/noUnusedImports: this is used in the jsdoc for `shouldResetAfter`
3-
import type { Response } from './interfaces';
1+
import type { RateLimitExceededErrorResponse } from './interfaces';
42

53
export type RateLimit = {
64
/**
7-
* The maximum amount of requests that can be made in the time window of {@link shouldResetAfter}.
5+
* The maximum amount of requests that can be made in the time window of {@link RateLimit.shouldResetAfter}.
86
*/
97
limit: number;
108
/**
@@ -18,7 +16,7 @@ export type RateLimit = {
1816
* and {@link RateLimit.remainingRequests} goes back to the value of
1917
* {@link RateLimit.limit}.
2018
*
21-
* @see {@link import('./interfaces').Response.retryAfter}
19+
* @see {@link RateLimitExceededErrorResponse.retryAfter}
2220
*/
2321
shouldResetAfter: number;
2422
};

0 commit comments

Comments
 (0)