Skip to content

Commit 1e5be5a

Browse files
committed
fix: mistake in HasRequiredProperties type
1 parent a0fd079 commit 1e5be5a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/runtime/typeUtils.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@ import type { Ref } from 'vue';
55

66
export type OmitStrict<Object, Key extends keyof Object> = Omit<Object, Key>;
77

8-
export type HasRequiredProperties<Object> = Object extends {} | null | undefined
9-
? false
10-
: true;
8+
export type HasRequiredProperties<Object> =
9+
// if any empty object can be assigned to Object
10+
{} extends Object
11+
? false
12+
: // if null can be assigned to Object
13+
null extends Object
14+
? false
15+
: // if undefined can be assigned to Object
16+
undefined extends Object
17+
? false
18+
: true;
1119

1220
/** @see {@link https://github.com/nuxt/nuxt/blob/42114f44a60ae326b58c05afe92ad535227d8f37/packages/nuxt/src/app/composables/fetch.ts#L20} */
1321
export type ComputedOptions<T extends Record<string, any>> = {

0 commit comments

Comments
 (0)