Merge pull request #1208 from sveltejs/gh-1207

Add TypeScript definitions for store (fixes #1207)
pull/1813/head
Rich Harris 6 years ago committed by GitHub
commit d1f35dfd85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,6 +13,7 @@
"shared.js",
"store.js",
"store.umd.js",
"store.d.ts",
"svelte",
"README.md"
],

19
store.d.ts vendored

@ -0,0 +1,19 @@
interface Options {
immutable: boolean;
}
interface Cancellable {
cancel: () => void;
}
type State = Record<string, any>;
export declare class Store {
constructor(state: State, options?: Options);
public compute(key: string, dependencies: string[]): void;
public fire(name: string, data?: any): void;
public get(): State;
public on(name: string, callback: (data: any) => void): Cancellable;
public set(state: State);
}
Loading…
Cancel
Save