admin管理员组文章数量:1416321
I am trying to use Semantic-UI-Vue
in my vue project. However, I am getting the following error when I try and do Vue.use(SuiVue)
:
Argument of type 'typeof import("semantic-ui-vue")' is not assignable to parameter of type 'PluginObject<{}> | PluginFunction<{}>'.\n Type 'typeof import("semantic-ui-vue")' is not assignable to type 'PluginFunction<{}>'.\n Type 'typeof import("semantic-ui-vue")' provides no match for the signature '(Vue: VueConstructor, options?: {} | undefined): void'."
I have created a .d.ts
file that lets me import SuiVue:
declare module 'semantic-ui-vue'{}
And I import it in my app.ts
as:
import * as SuiVue from 'semantic-ui-vue';
What do I need to do to get this plugin to be usable in a typescript project without disabling global TypeScript settings like noImplicitAny
?
I am trying to use Semantic-UI-Vue
in my vue project. However, I am getting the following error when I try and do Vue.use(SuiVue)
:
Argument of type 'typeof import("semantic-ui-vue")' is not assignable to parameter of type 'PluginObject<{}> | PluginFunction<{}>'.\n Type 'typeof import("semantic-ui-vue")' is not assignable to type 'PluginFunction<{}>'.\n Type 'typeof import("semantic-ui-vue")' provides no match for the signature '(Vue: VueConstructor, options?: {} | undefined): void'."
I have created a .d.ts
file that lets me import SuiVue:
declare module 'semantic-ui-vue'{}
And I import it in my app.ts
as:
import * as SuiVue from 'semantic-ui-vue';
What do I need to do to get this plugin to be usable in a typescript project without disabling global TypeScript settings like noImplicitAny
?
1 Answer
Reset to default 4Replace declare module 'semantic-ui-vue'{}
with declare module 'semantic-ui-vue';
declare module 'semantic-ui-vue'{}
means the module have the type of an empty object {}
.
declare module 'semantic-ui-vue';
means the module have the type any
see Shorthand ambient modules in https://www.typescriptlang/docs/handbook/modules.html
As the OP has figured out, you need to change the import statement to import SuiVue from 'semantic-ui-vue';
for it to work
本文标签: How to Vueuse() a javascript plugin in a TypeScript project that does have typingsStack Overflow
版权声明:本文标题:How to Vue.use() a javascript plugin in a TypeScript project that does have typings - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745251133a2649827.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论