I am trying to export/import an interface in Typescript but I am getting this error, I am not sure what I am doing wrong here
Uncaught SyntaxError: The requested module '/src/types/settings.ts' does not provide an export named 'Settings'
In my types/settings.ts I have this
export interface Settings {
activeUser: number
}
And I import it like this
import { Settings } from '@/types/settings'
And here is my tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"baseUrl": "./src/",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"paths": {
"@/*": ["src/*"],
},
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"isolatedModules": false
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}
I am using Vue/Vite with Typescript
Entries in paths are resolved relative to baseUrl. Try this:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
}
… or this:
{
"compilerOptions": {
"baseUrl": "./src/",
"paths": {
"@/*": ["./*"]
}
}
}