aboutsummaryrefslogtreecommitdiff
path: root/source/library/runes.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'source/library/runes.d.ts')
-rw-r--r--source/library/runes.d.ts37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/library/runes.d.ts b/source/library/runes.d.ts
new file mode 100644
index 0000000..4b73482
--- /dev/null
+++ b/source/library/runes.d.ts
@@ -0,0 +1,37 @@
+
+
+
+/*** EXPORT ------------------------------------------- ***/
+
+/**
+ * Ambient declarations for Svelte 5 runes so `deno check` can type-check
+ * `.svelte.ts` files. The runtime forms are injected by the Svelte compiler.
+ */
+
+declare function $state<T>(initial: T): T;
+declare function $state<T>(): T | undefined;
+
+declare namespace $state {
+ function raw<T>(initial: T): T;
+ function raw<T>(): T | undefined;
+ function snapshot<T>(value: T): T;
+}
+
+declare function $derived<T>(expression: T): T;
+
+declare namespace $derived {
+ function by<T>(fn: () => T): T;
+}
+
+declare function $effect(fn: () => void | (() => void)): void;
+
+declare namespace $effect {
+ function pre(fn: () => void | (() => void)): void;
+ function root(fn: () => void | (() => void)): () => void;
+ function tracking(): boolean;
+}
+
+declare function $props<T = Record<string, unknown>>(): T;
+declare function $bindable<T>(fallback?: T): T;
+declare function $inspect<T>(...values: T[]): { with: (fn: (type: "init" | "update", ...values: T[]) => void) => void };
+declare function $host<T extends HTMLElement = HTMLElement>(): T;