[Vuejs]-How can I define and use my own custom services in Nuxt with TypeScript?

0👍

After banging my head against the wall for about a day I found my answer in this github issue.

Apparently the version of @nuxt/typescript-runtime that shipped with my create-nuxt-app generated app with TypeScript was "@nuxt/typescript-runtime": "^1.0.0" which is outdated.

To fix this I ran

yarn add @nuxt/typescript-runtime --dev

in my terminal to upgrade to "@nuxt/typescript-runtime": "^2.0.0", and now my import works just fine as is. I see that the package was bumped a little over a month ago so hopefully nobody else runs into the same problem, and if they do I hope this answer can be of help.

Leave a comment