docs: update strict checks section with new default (#26965)

This commit is contained in:
Fabian B 2024-04-26 17:05:04 +02:00 committed by GitHub
parent 62030cad96
commit 57e1a60b21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,18 +76,18 @@ Overwriting options such as `"compilerOptions.paths"` with your own configuratio
In case you need to extend options provided by `./.nuxt/tsconfig.json` further, you can use the [`alias` property](/docs/api/nuxt-config#alias) within your `nuxt.config`. `nuxi` will pick them up and extend `./.nuxt/tsconfig.json` accordingly. In case you need to extend options provided by `./.nuxt/tsconfig.json` further, you can use the [`alias` property](/docs/api/nuxt-config#alias) within your `nuxt.config`. `nuxi` will pick them up and extend `./.nuxt/tsconfig.json` accordingly.
:: ::
## Stricter Checks ## Strict Checks
TypeScript comes with certain checks to give you more safety and analysis of your program. TypeScript comes with certain checks to give you more safety and analysis of your program.
Once youve converted your codebase to TypeScript and felt familiar with it, you can start enabling these checks for greater safety ([read more](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks)). [Strict checks](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks) are enabled by default in Nuxt 3 to give you greater type safety.
In order to enable strict type checking, you have to update `nuxt.config`: If you are currently converting your codebase to TypeScript, you may want to temporarily disable strict checks by setting `strict` to `false` in your `nuxt.config`:
```ts twoslash [nuxt.config.ts] ```ts twoslash [nuxt.config.ts]
export default defineNuxtConfig({ export default defineNuxtConfig({
typescript: { typescript: {
strict: true strict: false
} }
}) })
``` ```