Created
October 22, 2018 10:36
-
-
Save tomcon/ba8615668de8ea5d68fe92de5dd7571f to your computer and use it in GitHub Desktop.
Project-wide Svelte component typings for VSCde
This file contains hidden or 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