0

I have a javascript file and I am trying to use in another file, but this file is defined typescript " < script lang="ts" >".

this.$toast.error('Text ');

When i am using this command in a vue.js file standard I don't have errors but when I used it in typescript file I receive the next error:

Property '$toast' does not exist on type 'MyTypescriptComponent'.

I mention that it is working but i receive that error.

0

1 Answer 1

0

There is a workaround to dismiss the error, for the example you can do this:

toast: any = this.$toast;
mounted() {
  this.toast = this.$toast;
}
yourMethod() {
  this.toast.error('Text ');
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.