Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It would be great make OptionsType exported #74

Open
APeltick opened this issue Jun 2, 2024 · 1 comment
Open

It would be great make OptionsType exported #74

APeltick opened this issue Jun 2, 2024 · 1 comment

Comments

@APeltick
Copy link

APeltick commented Jun 2, 2024

I make my custom functions to handle cookies, they extra logic, and for server components lib require options, so pls make OptionsType exported. Thx. @andreizanik

// pls make OptionsType exported
import { type OptionsType } from 'cookies-next';
import {
  deleteCookie,
  getCookie,
  setCookie,
} from 'cookies-next';

import { type Place } from '../types/place-types';

const currentPlaceCookieName = 'currentPlace';

export function getCookieCurrentPlace(options: OptionsType): string | undefined {
  return getCookie(currentPlaceCookieName);
}

export function setCookieCurrentPlace(place: Place): void {
  setCookie(currentPlaceCookieName, place);
}

export function deleteCookieCurrentPlace(): void {
  deleteCookie(currentPlaceCookieName);
}
@JonasDoe
Copy link

As a workaround, you can go with NonNullable<Parameters<typeof getCookie>[1]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants