在Typescript中制作简单的Qtip描述符(Making simple Qtip descriptor in Typescript)

编程入门 行业动态 更新时间:2024-10-28 22:24:44
在Typescript中制作简单的Qtip描述符(Making simple Qtip descriptor in Typescript)

我正在将大量的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

本文发布于:2023-07-05 02:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1032140.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:简单   Qtip   Typescript   descriptor   simple

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!