Prev Next

Web / Typescript interview questions

What is namespace in Typescript?

A namespace is a way to logically group related classes or interfaces in a wrapper.

Namespaces are simply named JavaScript objects in the global namespace. This makes namespaces a very simple construct to use.

export namespace Shapes {
    export class Triangle { /* ... */ }
    export class Square { /* ... */ }
}

Namespace is also known as internal modules.

More Related questions...

Show more question and Answers...


Comments & Discussions