fix(types): narrow refresh token rotation inputs (#10257)

This commit is contained in:
backryun
2026-08-14 12:57:58 +09:00
committed by GitHub
parent 9da4e24013
commit 13098989e8
2 changed files with 4 additions and 2 deletions

View File

@@ -112,8 +112,8 @@ export async function serializeRefresh<T>(provider: string, fn: () => Promise<T>
* and codex-lb's replica race-detection.
*/
export function wasRefreshTokenRotated(
attemptedRefreshToken: string | null | undefined,
latestRefreshToken: string | null | undefined
attemptedRefreshToken: unknown,
latestRefreshToken: unknown
): boolean {
return (
typeof attemptedRefreshToken === "string" &&

View File

@@ -109,4 +109,6 @@ test("wasRefreshTokenRotated: true only when the DB token changed to a non-empty
assert.equal(wasRefreshTokenRotated("rt-old", ""), false, "empty DB token = deactivate");
assert.equal(wasRefreshTokenRotated(null, "rt-new"), false, "unknown attempted = deactivate");
assert.equal(wasRefreshTokenRotated(undefined, undefined), false);
assert.equal(wasRefreshTokenRotated("rt-old", { token: "rt-new" }), false);
assert.equal(wasRefreshTokenRotated(42, "rt-new"), false);
});