0 votes
in TypeScript - JavaScript's Superset by
What are the Modules in Typescript?

1 Answer

0 votes
by
A module is a powerful way to create a group of related variables, functions, classes, and interfaces, etc. It can be executed within their own scope, not in the global scope. In other words, the variables, functions, classes, and interfaces declared in a module cannot be accessible outside the module directly.

Creating a Module

A module can be created by using the export keyword and can be used in other modules by using the import keyword.

module module_name{  

    class xyz{  

        export sum(x, y){  

            return x+y;  

         }  

    }  

}

Related questions

0 votes
asked Mar 22, 2022 in TypeScript - JavaScript's Superset by sharadyadav1986
0 votes
asked Mar 23, 2022 in TypeScript - JavaScript's Superset by sharadyadav1986
...