user1037355
user1037355

Reputation:

How to export an interface from a single vue component?

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';

export interface OChannelsFilterFormForm {
    filterBy: {
      youCreated: boolean,
      youCanAddTo: boolean,
      hideType: string
    },
    sortBy: string
  }

@Component({
  components: {
    AButtonSubmit,
    ValidationObserver
  }
})
export default class OChannelsFilterForm extends Vue {
  form: any = {
    filterBy: {
      youCreated: false,
      youCanAddTo: false,
      hideType: 'none'
    },
    sortBy: 'aToZ'
  };

  submit () {
    this.$emit('child-output', this.form);
    this.$emit('close');
  }
}
</script>

All fine, import the interface into another vue component and the ide does not complain.

But as soon as I build, typescript says he interface cannot be found :/

Is there a way to export interfaces from a single vue component and import into another?

Upvotes: 1

Views: 7148

Answers (1)

user1037355
user1037355

Reputation:

The answer was simple - add the .vue extension when importing.

Upvotes: 1

Related Questions