Minima.js API / @minimajs/cookie / cookies
Function: cookies()
ts
function cookies<T>(): T;Defined in: index.ts:86
Retrieves all cookies from the current request as a typed record.
Type Parameters
T
T = Record<string, string>
Type definition for the cookie object (defaults to Record<string, string>)
Returns
T
All cookies as a typed record
Example
typescript
// Get all cookies (untyped)
const allCookies = cookies();
// Type: Record<string, string>
// Get all cookies with type safety
interface UserCookies {
sessionId?: string;
theme?: "light" | "dark";
}
const userCookies = cookies<UserCookies>();
// Type: UserCookiesSince
1.0.0