N
Nuxt2mo ago
Kopča

Auto import util VSCode error

Hi I am facing error, that is just really annoying. I have a file in util folder, for simplicity it could look like this:
export const toUpperCase = (str: string) => {
return str.toUpperCase();
};
export const toUpperCase = (str: string) => {
return str.toUpperCase();
};
Then, when I want to use it in any component template VS code gives an error Property 'toUpperCase' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>> but code works. It gives no error when using in script tag. Only two ways I was able to somehow resolve it was writing this in script
import { toUpperCase } from "#imports";
import { toUpperCase } from "#imports";
or renaming it and using with diferent name like this
const _toUpperCase = toUpperCase;
const _toUpperCase = toUpperCase;
Does anyone else had same issue?
3 Replies
Want results from more Discord servers?
Add your server