Created
October 22, 2018 03:33
-
-
Save mrkishi/eef15f253ca46688c19b85891debbab7 to your computer and use it in GitHub Desktop.
Project-wide Svelte components type declaration for vscode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module '*.svelte' { | |
type Data = { [key]: any } | |
type Changed = { [key]: boolean } | |
type Listener = { cancel: () => void } | |
export default class Component { | |
root: Component | |
options: Data | |
constructor(init: { target: Element, data: Data }) | |
set(data: Data) | |
get(): Data | |
on(event: string, callback: (event: any) => void): Listener | |
on(event: 'state', callback: ({ changed: Changed, current: Data, previous: Data }) => void): Listener | |
on(event: 'destroy', callback: () => void): Listener | |
fire(event: string, data: any) | |
destroy() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment