[@nuxtjs/toast][Question] Property '$toast' does not exist on type 'Top'.

sdr0x07b6
10
sdr0x07b6
commented 5 months ago
  • nuxt v2.10.2
  • @nuxtjs/toast v3.3.0

What is happening

It works, but an error is displayed on the terminal.
Property '$toast' does not exist on type 'Top'.

What I did

  1. I created a TypeScript project based on nuxt-community/typescript-template
    vue init nuxt-community/typescript-template mypj

  2. Added @nuxtjs/toast
    yarn add @nuxtjs/toast

  3. A module has been loaded.
    nuxt.config.ts

{
  ...,
  modules: [
    ...,
    ['@nuxtjs/toast', {
      position: 'top-right',
      duration: 5000,
    }],
  ],
  ...,
}
  1. I used $toast on page Top.
    pages/index.vue
<template>
  <button @click="click">Toast</button>
</template>


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

@Component
export default class Top extends Vue {
  private click() {
    this.$toast.show('Message')
  }
}
</script>

Question

The module is loaded and working, but an error is displayed.
Do I have anything else to do?

0
Informations
Question โ€ข Unresolved
#c53 - Created 5 months ago