diff --git a/packages/nuxt/src/app/composables/cookie.ts b/packages/nuxt/src/app/composables/cookie.ts index 7a7d6eb937..666e43961f 100644 --- a/packages/nuxt/src/app/composables/cookie.ts +++ b/packages/nuxt/src/app/composables/cookie.ts @@ -15,7 +15,7 @@ export interface CookieOptions extends _CookieOptions { default?: () => T | Ref } -export interface CookieRef extends Ref {} +export interface CookieRef extends Ref {} const CookieDefaults: CookieOptions = { path: '/', @@ -23,7 +23,7 @@ const CookieDefaults: CookieOptions = { encode: val => encodeURIComponent(typeof val === 'string' ? val : JSON.stringify(val)) } -export function useCookie (name: string, _opts?: CookieOptions): CookieRef { +export function useCookie (name: string, _opts?: CookieOptions): CookieRef { const opts = { ...CookieDefaults, ..._opts } const cookies = readRawCookies(opts) || {} diff --git a/test/fixtures/basic/types.ts b/test/fixtures/basic/types.ts index db32fda10d..0dab812239 100644 --- a/test/fixtures/basic/types.ts +++ b/test/fixtures/basic/types.ts @@ -161,9 +161,9 @@ describe('composables', () => { expectTypeOf(useState('test', () => ref('hello'))).toEqualTypeOf>() expectTypeOf(useState('test', () => 'hello')).toEqualTypeOf>() - expectTypeOf(useCookie('test', { default: () => ref(500) })).toEqualTypeOf>() - expectTypeOf(useCookie('test', { default: () => 500 })).toEqualTypeOf>() - useCookie('test').value = null + expectTypeOf(useCookie('test', { default: () => ref(500) })).toEqualTypeOf>() + expectTypeOf(useCookie('test', { default: () => 500 })).toEqualTypeOf>() + useCookie('test').value = null expectTypeOf(useAsyncData('test', () => Promise.resolve(500), { default: () => ref(500) }).data).toEqualTypeOf>() expectTypeOf(useAsyncData('test', () => Promise.resolve(500), { default: () => 500 }).data).toEqualTypeOf>()