typescript error with vite
zygzagZ opened this issue · comments
when using unplugin-auto-import in vite+vue+ts project, linter fails with following error:
Cannot find name 'Plugin$1'. Did you mean 'Plugin'?
./node_modules/unplugin-auto-import/dist/vite.d.ts:5:60
indeed, there seems to be some kind of error in file unplugin-auto-import/dist/vite.d.ts
:
import { Options } from './types';
import '@antfu/utils';
import '@rollup/pluginutils';
declare const _default: (options?: Options | undefined) => Plugin$1;
export { _default as default };
token Plugin$1
is not defined anywhere, thus it throws an error.
Plugin$1
is used internally in node_modules/unplugin/dist/index.d.ts:5
as an alias to vite's plugin: import { Plugin as Plugin$1 } from 'vite';
Here is corresponding file from unplugin-vue-components
:
import * as vite from 'vite';
import { Options } from './types';
import '@rollup/pluginutils';
import 'unplugin';
declare const _default: (options?: Options | undefined) => vite.Plugin;
export { _default as default };
Here, vite plugin's types are imported directly from vite, thus available to the ts parser and it works.
Unfortunately, I have no idea what to change in source code in order to fix this here.
I am totally stunned by the quickness of your fix! Everything works now, thank you!