shytikov shytikov - 1 year ago 150
TypeScript Question

Create typings for nested namespaces in typescript

I'm trying to create typings definitions for already existed library, and having issues describe its structure properly. The problem is nested namespaces. In JavaScript full name of my method looks like this:


But I'm not able to create proper
definition file... I've tried different combinations, with
export interface
export module
for nested namespaces... But nothing works. The only construction that does not fire any errors is following:

declare namespace NameSpace1 {

But this is not enough... Do you know how to properly describe such a nested namespaces in TypeScript definitions?

Answer Source
declare namespace NameSpace1.NameSpace2.NameSpace3 {
  function MethodName(): void;

There are literally thousands of examples of how to write definition files at ; I'd recommend looking for something similar to what you have next time you're stuck.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download