nuxt / typescript

TypeScript Support for Nuxt 2

Home Page:https://typescript.nuxtjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation unclear

tkalmar opened this issue · comments

Describe the bug
In https://typescript.nuxtjs.org/cookbook/plugins#plugin-2 an combined example is shown.
The used inject does not add $myInjectedFunction to the context.
I think the part:

 // nuxtContext.$myInjectedFunction
  interface Context {
    $myInjectedFunction(message: string): void
  }

is therefore wrong
either a direct setter of the context.$myInjectedFunction prop is missing, or the typing for context should be removed
or
The blue box stating that inject injects into context.app ...

Yes the comment // nuxtContext.$myInjectedFunction must be removed or corrected in combined example

Nuxt's inject does actually inject to Context now. It has been like that for long enough now that it's OK to assume that it's always the case.