Reputation: 809
I'm new to Typescript and currently trying to build a Vue Apps with Typescript. I wanted to make an interface
that could be accessed globaly to any components, so I made a file called ~/utils/types.ts
// types.ts
export interface Url {
name: string
params?: Object
query?: Object
}
export interface Links {
text: string
url: Url
}
When I tried to import it on my component, it gave me warning like below
It actually works, but it shows that warning in VScode. What should I do to solve this?
Upvotes: 1
Views: 3329
Reputation: 53
In my case, my tsconfig.json
file included this references property formatted like so:
"references": [
{
"path": "./tsconfig.vite-config.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
}
]
All I did was remove the last two "path" properties, making my entire tsconfig.json
file looking like this:
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions":
{
"baseUrl": ".",
"paths":
{
"@/*": ["./src/*"]
}
},
"references": [
{
"path": "./tsconfig.vite-config.json"
}
]
}
I don't fully understand why/how those path properties were causing the issue, but that's what did it for me. Hopefully this will help someone else!
Upvotes: 3