TypeScript External Modules

TypeScript External Modules | What is an External Modules?

External Modules –  
External modules are useful in sense they hide the internal statements of the module definitions and show only the methods and parameters associated to the declared variable.

It is using when dealing with large JavaScript based applications.
When we using nodejs or external modules, you can export an entire module and then import it into another module.

Stayed Informed – Learn Angular 2 with TypeScript

Example -

// userList.ts file
// imports the users.ts file as the users module
import impUser = module('users');

export function userList() {
    var user = new impUser.users();
    user.getUsers();
}

// users.ts file
// exports the entire module
export class users {
    getUsers() {
         return ["Anil", "Alok", "Dilip"];
    }
}

I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

TypeScript External Modules | What is an External Modules? TypeScript External Modules | What is an External Modules? Reviewed by Anil Singh on 2:57 AM Rating: (5)
www.code-sample.com/. Powered by Blogger.
^