import TS file to Vue file

Viewed 4151

I've made a ts file with an enum and interface, and I need to use them in Vue components. However, when I try to import the ts file into my Vue components, I get an error that says it can't find the module.

My src/models/Profile.ts file looks like this:

export enum Status {
    NONE,
    ACCEPTING,
    NOT_ACCEPTING,
}

export interface Profile {
    status: Status,
    firstName: string,
    lastName: string,
}

The Vue component I'm trying to import the above:

import Profile from '@/models/Profile.ts';

@Component({computed: mapGetters(['user'])})
export default class CreateProfile extends Vue {
    ...
}

Specific error:

An import path cannot end with a '.ts' extension. Consider importing '@/models/Profile' instead.

But when I try that, I get:

Cannot find module '@/models/Profile'.
0 Answers
Related