fix(nuxt): add undefined type for useCookie return value

This commit is contained in:
cany748 2023-04-07 15:45:44 +07:00 committed by GitHub
parent b068f79fee
commit 4f0b3c7223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ const CookieDefaults: CookieOptions<any> = {
encode: val => encodeURIComponent(typeof val === 'string' ? val : JSON.stringify(val))
}
export function useCookie <T = string | null> (name: string, _opts?: CookieOptions<T>): CookieRef<T> {
export function useCookie <T = string | null | undefined> (name: string, _opts?: CookieOptions<T>): CookieRef<T> {
const opts = { ...CookieDefaults, ..._opts }
const cookies = readRawCookies(opts) || {}