typescriptnuxt.jshtml-meta

Nuxtjs using typescript has problem with using meta


In Nuxt.js I put my permissionKeys of the page so that I could check user's access in the middleware. When my script language is JS everything works like a charm, however, in the case of lang="ts" I face errors.

I've looked for the solution and using vue-meta package, but i ended up getting the same error.

<script lang="ts">
export default {
  meta: {
    authorization: ['Organization/List']
  },
  data() {
    return {
           text: this.$t('organization.title'),
    }
   }
}

in this case I face this error:

Property '$t' does not exist on type '{ meta: { authorization: string[]; }; data(): any; }'.

I don't know what is the problem of using meta and global varaibles.


Solution

  • It seems that the definition of meta key in route was added recently: https://github.com/nuxt/typescript/pull/89