Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/composables/cookie.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@ export interface CookieOptions<T = any> extends _CookieOptions {
default?: () => T | Ref<T>
}

export interface CookieRef<T> extends Ref<T> {}
export interface CookieRef<T> extends Ref<T | null> {}

const CookieDefaults: CookieOptions<any> = {
path: '/',
Expand Down
5 changes: 3 additions & 2 deletions test/fixtures/basic/types.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,8 +154,9 @@ describe('composables', () => {
expectTypeOf(useState('test', () => ref('hello'))).toEqualTypeOf<Ref<string>>()
expectTypeOf(useState('test', () => 'hello')).toEqualTypeOf<Ref<string>>()

expectTypeOf(useCookie('test', { default: () => ref(500) })).toEqualTypeOf<Ref<number>>()
expectTypeOf(useCookie('test', { default: () => 500 })).toEqualTypeOf<Ref<number>>()
expectTypeOf(useCookie('test', { default: () => ref(500) })).toEqualTypeOf<Ref<number | null>>()
expectTypeOf(useCookie('test', { default: () => 500 })).toEqualTypeOf<Ref<number | null>>()
useCookie('test').value = null

expectTypeOf(useAsyncData('test', () => Promise.resolve(500), { default: () => ref(500) }).data).toEqualTypeOf<Ref<number | null>>()
expectTypeOf(useAsyncData('test', () => Promise.resolve(500), { default: () => 500 }).data).toEqualTypeOf<Ref<number | null>>()
Expand Down