December 2017
Beginner
372 pages
10h 32m
English
TypeScript provides a keyword, namespace, which allows us to encapsulate the related functions, classes, and interfaces under one umbrella. The syntax of defining namespace is very straightforward, as follows:
namespace WebServiceResponse{}
All the functions, classes, and interfaces will go inside the curly braces of the namespace. Anyone outside the namespace can access these by using the dot notation–that is, <<namespace name>>.<<function/class name>>.
Now, by default, all the functions and classes that will be defined under the namespace will not be visible to anyone outside the namespace, as shown in the following code snippet:
In line number 18, we have a warning from the TypeScript compiler, mentioning that ...
Read now
Unlock full access