Renovamen / oh-vue-icons

A Vue component for importing inline SVG icons from different popular icon packs easily.
https://oh-vue-icons.js.org
Other
244 stars 22 forks source link

Integration Nuxt + Typescript #16

Open LuizPelegrini opened 3 years ago

LuizPelegrini commented 3 years ago

Hi there, I am trying to use the package in a Nuxt project with typescript and I am getting this error when I try to use it

Type 'typeof import("~/node_modules/oh-vue-icons/types/index")' is not assignable to type 'Component<any, any, any, any> | AsyncComponent<any, any, any, any>'.
Type 'typeof import("~/node_modules/oh-vue-icons/types/index")' is not assignable to type 'AsyncComponentFactory<any, any, any, any>'.
Type 'typeof import("~/node_modules/oh-vue-icons/types/index")' provides no match for the signature '(): { component: Promise<ImportedComponent<any, any, any, any>>; loading?: ImportedComponent<DefaultData<never>, DefaultMethods<never>, DefaultComputed, DefaultProps> | undefined; error?: ImportedComponent<...> | undefined; delay?: number | undefined; timeout?: number | undefined; }'.

Usage:

<script lang="ts">
import Vue from 'vue';
import OhVueIcon from 'oh-vue-icons';

export default Vue.extend({
  components: {
    'v-icon': OhVueIcon, // <<< error is thrown here
  },
});
</script>

I've already added the transpilation step in nuxt.config.js

build: {
    transpile: ['oh-vue-icons']
}

Is there anything I'm missing here?

Renovamen commented 3 years ago

Hi, have you tried importing the package following this?