Creating a Namespace in TypeScript Declaration Files
Learn how to create a namespace in TypeScript declaration files to group functions and properties of classes together.
We'll cover the following
When writing declaration files, we need a way of grouping functions and properties
of classes under the class name. TypeScript uses the module
keyword as a means of creating a namespace so that all functions or properties of a class can be grouped together within the class namespace.
Creating a namespace
Let’s take a look at the first version of a declaration file for our ErrorHelper
JavaScript
class in the file named globals.d.ts
:
Get hands-on with 1400+ tech skills courses.