Reputation: 9558
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:
NameSpace1.NameSpace2.NameSpace3.MethodName()
But I'm not able to create proper d.ts
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?
Upvotes: 3
Views: 9513
Reputation: 221104
declare namespace NameSpace1.NameSpace2.NameSpace3 {
function MethodName(): void;
}
There are literally thousands of examples of how to write definition files at https://github.com/DefinitelyTyped/DefinitelyTyped ; I'd recommend looking for something similar to what you have next time you're stuck.
Upvotes: 6