From e2371321341ca65b61185a42afce1eda29f90c26 Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Wed, 22 Jan 2025 18:45:38 +0100 Subject: [PATCH] fix: correct types --- packages/svelte/src/ambient.d.ts | 10 +++++++++- packages/svelte/types/index.d.ts | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/svelte/src/ambient.d.ts b/packages/svelte/src/ambient.d.ts index b0dc898659..0d6d45dfc2 100644 --- a/packages/svelte/src/ambient.d.ts +++ b/packages/svelte/src/ambient.d.ts @@ -20,7 +20,11 @@ declare module '*.svelte' { * * @param initial The initial value */ -declare function $state(initial?: T, options?: import('svelte').StateOptions): T; +declare function $state( + initial: undefined, + options?: import('svelte').StateOptions +): T | undefined; +declare function $state(initial: T, options?: import('svelte').StateOptions): T; declare function $state(initial: T): T; declare function $state(): T | undefined; @@ -117,6 +121,10 @@ declare namespace $state { * * @param initial The initial value */ + export function raw( + initial: undefined, + options?: import('svelte').StateOptions + ): T | undefined; export function raw(initial?: T, options?: import('svelte').StateOptions): T; export function raw(initial: T): T; export function raw(): T | undefined; diff --git a/packages/svelte/types/index.d.ts b/packages/svelte/types/index.d.ts index 6b6dcfdc81..176de125a6 100644 --- a/packages/svelte/types/index.d.ts +++ b/packages/svelte/types/index.d.ts @@ -2679,7 +2679,11 @@ declare module 'svelte/types/compiler/interfaces' { * * @param initial The initial value */ -declare function $state(initial?: T, options?: import('svelte').StateOptions): T; +declare function $state( + initial: undefined, + options?: import('svelte').StateOptions +): T | undefined; +declare function $state(initial: T, options?: import('svelte').StateOptions): T; declare function $state(initial: T): T; declare function $state(): T | undefined; @@ -2776,6 +2780,10 @@ declare namespace $state { * * @param initial The initial value */ + export function raw( + initial: undefined, + options?: import('svelte').StateOptions + ): T | undefined; export function raw(initial?: T, options?: import('svelte').StateOptions): T; export function raw(initial: T): T; export function raw(): T | undefined;