Skip to content

Commit

Permalink
Add NodeCookie ts definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
microcipcip committed Aug 5, 2022
1 parent c54ec8a commit f810c09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/cookie-universal-nuxt/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CookieSerializeOptions } from "cookie";
import { CookieParseOptions, CookieSerializeOptions } from "cookie";

// augment typings of Vue.js
import "./vue";
Expand All @@ -16,6 +16,11 @@ interface SetParams {
opts?: CookieSerializeOptions;
}

interface NodeCookie {
parse(str: string, options?: CookieParseOptions): Record<string, string>;
serialize(name: string, value: string, options?: CookieSerializeOptions): string;
}

export interface NuxtCookies {
set: (
name: string,
Expand All @@ -27,6 +32,7 @@ export interface NuxtCookies {
getAll: <T = CookieValue[]>(opts?: GetOptions) => T;
remove: (name: string, opts?: CookieSerializeOptions) => void;
removeAll: () => void;
nodeCookie: NodeCookie;
}

declare module "@nuxt/vue-app" {
Expand Down
2 changes: 1 addition & 1 deletion packages/cookie-universal/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CookieParseOptions, CookieSerializeOptions} from 'cookie'
import { CookieParseOptions, CookieSerializeOptions } from 'cookie'

type CookieValue = any

Expand Down

0 comments on commit f810c09

Please sign in to comment.