我正在将大量的Javascript重写为Typescript,我有jquery.d.ts文件,它允许我进行ajax调用等,但是我需要为Qtip创建自己的描述符。
我以为会是这样的:
interface JQuery { qtip(options:any); }但是这不起作用,只是一直告诉我qtip方法doesnt exist on value of type JQuery 。
我错过了什么吗? 正如我所说的那样:
$("#some-element").qtip({some: "options"});I am rewriting a large chunk of Javascript into Typescript and I have the jquery.d.ts file, which lets me do ajax calls etc, however I need to make my own descriptor for Qtip.
I thought it would be something like this:
interface JQuery { qtip(options:any); }However this doesn't work, just keeps telling me that the method qtip doesnt exist on value of type JQuery.
So am I missing something? as I call it like so:
$("#some-element").qtip({some: "options"});最满意答案
在jquery.d.ts中,调用$的结果名为JQuery ,而不是Jquery 。 这里的命名区分大小写。
Ends up this issue was down to the way I was building the project, I had 3 or 4 modules which were all interdependant. So the actual class which used this jquery extension reference was working fine. However when the subsequent files referenced the file without referencing the extension blew up but made it look like the problem was in the original file, not in the referencing file.
更多推荐
qtip,JQuery,options,ajax,电脑培训,计算机培训,IT培训"/> <meta name="desc
发布评论