I am encountering an issue while trying to export/import an interface in Typescript. The error message I receive is causing confusion as I'm unsure of where I went wrong.
Uncaught SyntaxError: The requested module '/src/types/settings.ts' does not provide an export named 'Settings'
Within my types/settings.ts file, the code is as follows:
export interface Settings {
activeUser: number
}
To import the interface, I use the following syntax:
import { Settings } from '@/types/settings'
In addition, here is a snippet from 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"]
}
My development environment consists of Vue/Vite with Typescript integration.