Vue 3 TS2322 Error: not assignable to type: ComponentInternalInstance
See original GitHub issueDescribe the bug On development server the icon works (without HMR though) but when building the project I get this TypeScript error:
error TS2322: Type '{ icon: string; }' is not assignable to type '{ $: ComponentInternalInstance; $data: {}; $props: FontAwesomeIconProps; $attrs: Data; $refs: Data; $slots: Readonly<InternalSlots>; ... 7 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & ... 5 more ... & Record<...>'. Type '{ icon: string; }' is missing the following properties from type '{ $: ComponentInternalInstance; $data: {}; $props: FontAwesomeIconProps; $attrs: Data; $refs: Data; $slots: Readonly<InternalSlots>; ... 7 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; }': $, $data, $props, $attrs, and 10 more.
Versions
"@fortawesome/vue-fontawesome": "^3.0.0-3",
"vue": "^3.0.7",
"typescript": "^4.2.3",
"vite": "^2.1.0",
Is there at least a way to ignore the error since the icons do show up on the dev server?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (2 by maintainers)
To have typings for global components, the following worked for me:
I’m using
vite
with thevolar
extension invscode
.This worked for me:
If you don’t want to write the lib files like @uinio described before.