I want to import type from type.d.ts file
import type { StateDefinition } from '../type'
vite cannot find file and throw error

So I should add extention .d.ts
import type { StateDefinition } from '../type.d.ts'
but I will get ts error in vscode

anyone can tell me how to fix it?
I had this exact same issue and figured out the following cause: if you're importing both interfaces and enums in the same statement like:
import { SomeType, AnEnum } from '@/types/general'
The import will be causing the error above. However, if you replace it to:
import type { SomeType } from '@/types/general.d.ts'`
Then it will work. Just put any enums you might have somewhere else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With