Skip to content

Commit e237132

Browse files
committed
fix: correct types
1 parent d0d9a36 commit e237132

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packages/svelte/src/ambient.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ declare module '*.svelte' {
2020
*
2121
* @param initial The initial value
2222
*/
23-
declare function $state<T>(initial?: T, options?: import('svelte').StateOptions): T;
23+
declare function $state<T>(
24+
initial: undefined,
25+
options?: import('svelte').StateOptions
26+
): T | undefined;
27+
declare function $state<T>(initial: T, options?: import('svelte').StateOptions): T;
2428
declare function $state<T>(initial: T): T;
2529
declare function $state<T>(): T | undefined;
2630

@@ -117,6 +121,10 @@ declare namespace $state {
117121
*
118122
* @param initial The initial value
119123
*/
124+
export function raw<T>(
125+
initial: undefined,
126+
options?: import('svelte').StateOptions
127+
): T | undefined;
120128
export function raw<T>(initial?: T, options?: import('svelte').StateOptions): T;
121129
export function raw<T>(initial: T): T;
122130
export function raw<T>(): T | undefined;

packages/svelte/types/index.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2679,7 +2679,11 @@ declare module 'svelte/types/compiler/interfaces' {
26792679
*
26802680
* @param initial The initial value
26812681
*/
2682-
declare function $state<T>(initial?: T, options?: import('svelte').StateOptions): T;
2682+
declare function $state<T>(
2683+
initial: undefined,
2684+
options?: import('svelte').StateOptions
2685+
): T | undefined;
2686+
declare function $state<T>(initial: T, options?: import('svelte').StateOptions): T;
26832687
declare function $state<T>(initial: T): T;
26842688
declare function $state<T>(): T | undefined;
26852689

@@ -2776,6 +2780,10 @@ declare namespace $state {
27762780
*
27772781
* @param initial The initial value
27782782
*/
2783+
export function raw<T>(
2784+
initial: undefined,
2785+
options?: import('svelte').StateOptions
2786+
): T | undefined;
27792787
export function raw<T>(initial?: T, options?: import('svelte').StateOptions): T;
27802788
export function raw<T>(initial: T): T;
27812789
export function raw<T>(): T | undefined;

0 commit comments

Comments
 (0)