Skip to content

Commit 0dbc4de

Browse files
committed
Add subscribe type definitions
1 parent 9d234a7 commit 0dbc4de

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

docs/App.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import camelCase from 'camelcase'
77
import Prism from 'prismjs'
88
99
// Hoist to `window` for debug
10+
// @ts-ignore
1011
window.toast = toast
1112
1213
let selected
@@ -19,6 +20,7 @@ const handleClick = (btn) => {
1920
selected = btn.name
2021
code = btn.code
2122
btn.run()
23+
// @ts-ignore
2224
window.gtag('event', 'toast', { event_label: btn.name })
2325
}
2426

jsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": "."
3+
"baseUrl": ".",
4+
"allowJs": true,
5+
"checkJs": true,
6+
"strict": false
47
},
58
"include": ["src/index.d.ts"]
69
}

src/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// index.d.ts
22
import type { SvelteComponent } from 'svelte'
33
import type { FlyParams } from 'svelte/types/runtime/transition/index'
4+
import type { Subscriber, Unsubscriber } from 'svelte/types/runtime/store/index'
45

56
declare module '@zerodevx/svelte-toast'
67

@@ -53,4 +54,5 @@ declare namespace toast {
5354
export function pop(arg?: any): void
5455
export function set(id: number, options?: SvelteToastOptions): void
5556
export function set(options: SvelteToastOptions): void
57+
export function subscribe(run: Subscriber): Unsubscriber
5658
}

0 commit comments

Comments
 (0)