Use TypeScript on Nuxt.js from v2.5
You can use TypeScript naturally in Nuxt now
Writing this article to revise my previous article about Nuxt+TS. Some people who read this article had misunderstood as that
nuxt-ts is still available to use TypeScript on Nuxt.
Currently, this article is valid until Nuxt 2.5–2.8.1 (June 4th, 2019). After 2.9, the official maintains the new way to support TypeScript on Nuxt. So this article is not worth reading anymore 😉
- To use TypeScript on Nuxt, install
- May need some typedefs for Nuxt features, then install
@types/node, then put
tsconfig.jsonon the project root
As I mentioned in the previous article, I’m now maintaining this repo. I’m keeping Nuxt’s version up-to-date in my some projects, and try to show the most minimum sample on the template.
Typescript starter with Nuxt.js. Contribute to nuxt-community/typescript-template development by creating an account on…
Official repo is also having some samples on examples dir (Search the page with
The Vue.js Framework. Contribute to nuxt/nuxt.js development by creating an account on GitHub.
create-nuxt-app is about to support TypeScript project.
add TypeScript integration by takehiro-takahashi · Pull Request #207 · nuxt/create-nuxt-app
Hello everyone ! Added TypeScript integration option for Merge nuxt / nuxt.js # 5079. This will allow you to use…
Originally, I tried to contribute to
create-nuxt-app , but gave up by thinking about writing TypeScript for the crazy number of cases which
create-nuxt-app had been already supporting.
So, may put some basic samples (like ESLint, testing, plugins, middlewares…etc) on
@nuxt-community/typescript-template instead. (Or build create-nuxt-ts-app? but I’d to learn why create-react-ts-app had gone firstly)
From Nuxt 2.5
No more nuxt-ts, write everything with "
nuxt-ts was just only for 2.4 at all 😂. We can just use
nuxt package/command even for we’d to use TypeScript.
ts-node is required instead.
Enable plugins/*.ts, modules/*.ts, middleware/*.ts and nuxt.config.ts
Typedefs are mostly provided
To have typings for Nuxt-ish things for example
fetch on the components. Add
@nuxt/vue-app (provided by
@nuxt/typescript npm module) on
tsconfig.json. Your custom
d.ts may be no longer needed.