在打字稿中的全局名称空间中添加函数
是否可以在打字稿中的全局名称空间中添加函数?
我的功能无处不在,这与某种编程样式息息相关,而我不希望在每个使用它的文件中都有导入。
我以为我在没有任何导出的情况下将此功能定义在文件中。编译器没有抱怨,但是在运行时找不到该功能。
Is it possible to add a function to the global namespace in TypeScript?
I have a function that I use so ubiquitously that is very much tied to a certain programming style that I don't want have an import in every file that uses it.
I thought I was close by defining this function in a file without any exports. The compiler did not complain, but at runtime the function was not found.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论