typescript definition



  • i juste finished write typescript definition for quasar framework

    PR typescript definition

    is anyone can test it



  • Where is the :

    declare module 'quasar' { 
    ...
    }
    

    Otherwise it is not easy to make a :

    import * as Quasar from 'quasar'
    

    Which is the way webpack import Quesar (from the docs) :-)

    Mine looks like this, not as extended as yours, but it works nicely with webpack and standard import.

    declare module 'quasar' {
        import Vue from 'vue'
    
        export let version: string
        export let install: any
        export let start: any
        export let theme: any
    
        export let ActionSheet: any
        export namespace Dialog {
            interface Button {
                label: string
                handler: {(data: any):void}
            }
    
            type FormType = 'textarea'|'chips'|'numeric'|'password'|'textbox'|'radio'|'checkbox'|'toggle'
            interface Form {
                type: FormType
                label: string
                model: any
                items: any
                max: number
                icon: string
            }
            interface Options {
                title: string
                message: string
                form: any
                stackButtons: boolean
                buttons: Button|string[]
                nobuttons: boolean
                progress: any
                onDismiss: {()}
                noBackdropDismiss: boolean
                noEscDismiss: boolean
            }
    
            function create( options: Options )
        }
        export let AppFullscreen: any
        export let AppVisibility: any
    
        export namespace Cookies {
            interface Options {
                expires?: number | Date
                path?: string
                domain?: string
                secure?: boolean
            }
    
            function get( key: string ) : string
            function set( key: string, value: string, options?: Options ) 
            function has( key: string ): boolean
            function remove( key: string , options: string ) : void
            function all()
        }
    
        type BrowserNames = 'vivaldi'|'silk'|'kindle'|'android'|'opera'|'playbook'|'blackberry'|'edge'|'ie'|'msie'
        type PlatformNames = 'ipad'|'ipod'|'windows phone'|'iphone'|'kindle'|
            'silk'|'android'|'win'|'mac'|'linux'|'cros'|'playbook'|'bb'|'blackberry'
    
        interface BrowserPlatform {
            // browser
            vivaldi?: boolean
            silk?: boolean
            kindle?: boolean
            android?: boolean
            opera?: boolean
            playbook?: boolean
            blackberry?: boolean
            edge?: boolean
            ie?: boolean
    
            desktop?: boolean
            ios?: boolean
            
            name: BrowserNames
            platform: PlatformNames
    
            version: string
            versionNumber: number
        }
    
        interface PlatformInfo {
            is: BrowserPlatform
            has: {
                touch: {():boolean}
                popstate: {():boolean}
            },
            within: {
                iframe: boolean
            }
        }
    
        export let Platform: PlatformInfo
        export let Events: any;
        export namespace Loading {
            interface Options {
                delay?: number
                spinner?: 'ios'|'tail'|'dots'
                message?: string
                spinnerSize?: number
                spinnerColor?: string
                messageColor?: string
            }
    
            function isActive() : boolean
            function show(options?: Options )
            function hide()
        }
        export namespace Toast {
            interface Options {
                html: string,
                icon?: string,
                timeout?: number,
                color?: string,
                bgColor?: string,
                button?: {
                    label?: string,
                    handler?: any
                    color?: string
                    },
                vm?: Vue
            }
            function create( options: Options ) : void 
            function setDefaults( options: Options ) : void 
    
        }
        export let Utils: any
        export let LocalStorage: any
        export let SessionStorage: any
    
        export namespace Component {
            export class Modal extends Vue {
                public open()
                public close()
                public toggle()
            }
    
            export class Infinite extends Vue {
                public loadMore()
                public reset()
                public stop()
                public resume()
                public poll()	
            }
        }
    }
    

Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.