admin管理员组文章数量:1323676
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 binations, 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?
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 binations, 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?
Share asked Aug 1, 2016 at 19:43 shytikovshytikov 9,5689 gold badges61 silver badges105 bronze badges1 Answer
Reset to default 6declare namespace NameSpace1.NameSpace2.NameSpace3 {
function MethodName(): void;
}
There are literally thousands of examples of how to write definition files at https://github./DefinitelyTyped/DefinitelyTyped ; I'd remend looking for something similar to what you have next time you're stuck.
本文标签: javascriptCreate typings for nested namespaces in typescriptStack Overflow
版权声明:本文标题:javascript - Create typings for nested namespaces in typescript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742142070a2422624.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论