Migration from Nuxt 2.8

TypeScript support has been externalized in dedicated packages and have been removed from core starting Nuxt 2.9. Here are the guidelines to migrate your existing Nuxt TypeScript project to the last specifications.

The following migration guide works for either nuxt or nuxt-edge.

1. Migrate dependencies

yarn remove @nuxt/typescript
yarn add --dev @nuxt/typescript-build
# OR
npm uninstall @nuxt/typescript
npm install --save-dev @nuxt/typescript-build

2. Add @nuxt/typescript-build module to your nuxt.config.js

// nuxt.config.js
export default {
  buildModules: ['@nuxt/typescript-build']
}

3. Replace @nuxt/vue-app and @nuxt/config by @nuxt/types in your tsconfig.json




 



// tsconfig.json
"compilerOptions": {
  "types": [
    "@nuxt/types"
  ]
}

If you were importing types from @nuxt/config you need to instead import them from @nuxt/types.

Types imports might have changed a little, you can get familiar with them either by triggering intellisense when importing or watch them live here now.

4. Move the customized options from build.typescript to module options

// nuxt.config.js
export default {
  typescript: {
    typeCheck: true,
    ignoreNotFoundWarnings: true
  }
}

You can also do it this way :

// nuxt.config.js
export default {
  buildModules: [
    ['@nuxt/typescript-build', {
      typeCheck: true,
      ignoreNotFoundWarnings: true
    }]
  ]
}

5. TypeScript Runtime (optional)

If your project is using TypeScript runtime (nuxt.config.ts, local modules or serverMiddlewares), please directly refer to the Runtime section.