Tuesday, 26 September 2017


Read external java script library function in Type Script

1. Declare Module

declare var Alert: Alert.IAlertJsStatic;

//javscript file name is alert.js
declare module 'alert' {
    export = Alert;
}

declare namespace Alert {
     
    
    interface IAlertJsConfig {
    }

    interface IAlertJsStatic extends IAlertJsConfig  {
        showLoading(str: string): void;
    }
    
}

2. Read Module in Type Script Code

 Alert.showLoading('');