cookies.d.ts 855 B

123456789101112131415161718192021
  1. import type { CookieSerializeOptions } from '../types';
  2. declare type GetWithOptionsOutput = {
  3. value: string | undefined;
  4. options: {
  5. [key: string]: string;
  6. };
  7. };
  8. export declare class Cookies extends Map<string, string> {
  9. constructor(input?: string | null);
  10. set(key: string, value: unknown, options?: CookieSerializeOptions): this;
  11. }
  12. export declare class NextCookies extends Cookies {
  13. response: Request | Response;
  14. constructor(response: Request | Response);
  15. get: (key: string) => string | undefined;
  16. getWithOptions: (key: string) => GetWithOptionsOutput;
  17. set: (key: string, value: unknown, options?: CookieSerializeOptions | undefined) => this;
  18. delete: (key: string, options?: CookieSerializeOptions) => boolean;
  19. clear: (options?: CookieSerializeOptions) => void;
  20. }
  21. export { CookieSerializeOptions };