typescript 打字稿 - 无法调用类型缺少签名的表达式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25761811/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Typescript - cannot invoke an expression whose type lack of signature
提问by wapt49
I am very new in typescript..
我在打字稿方面很新..
when Iam trying to invoke this javascript like this in typescript
当我试图在打字稿中像这样调用这个 javascript 时
window.location('http://localhost:1773/Repository/NetworkPlan/ExportPng');
I got compiler error message like this
我收到这样的编译器错误消息
cannot invoke an expression whose type lack of signature
cannot invoke an expression whose type lack of signature
Can anyone help me why I got this error?
任何人都可以帮助我为什么会出现此错误?
Thanks
谢谢
回答by Fenton
TypeScript is saving you from a slight coding error:
TypeScript 使您免于轻微的编码错误:
window.location.href = 'http://localhost:1773/Repository/NetworkPlan/ExportPng';
It isn't a method call, it is a property you set.
它不是方法调用,而是您设置的属性。