What are Modules in Typescript?

devquora
devquora

Posted On: Feb 22, 2018

 

Modules are powerful way to share code between files.By using modules effectively in your project you can keep you file size small and dependencies clear.

Modules are executed within their own scope, not in the global scope; this means that variables, functions, classes, etc. declared in a module are not visible outside the module unless they are explicitly exported using one of the export forms.

Creating a Module

module module_name{

	class xyz{
		export foo(x, y){
		 	return x*y;
		 }
	}

}

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Typescript Interview Questions

    What is Typescript?

    Typescript is a free and open-source programming language which is designed and developed by Microsoft. It was designed ..

    Typescript Interview Questions

    List some features of Typescript?

    Features of Typescript are:- Typescript can be compiled to all major versions of Javascript(ES3,ES5,ES6,ES7). Typescrip..

    Typescript Interview Questions

    List some benefits of using Typescript?

    Following are some benefits of using Typescript One of the biggest advantages of Typescript is its code completion and ..