(ts) disable noUncheckedIndexedAccess because of the huge count of errors

https://nuxt.com/docs/4.x/getting-started/upgrade#default-typescript-configuration-changes
This commit is contained in:
Valentyne Stigloher 2025-07-23 16:03:31 +02:00
parent 8e6f812a9a
commit 72d574a039
2 changed files with 16 additions and 10 deletions

View File

@ -1,4 +0,0 @@
{
// necessary for a peculiar edge case where the symlinked locale to data/ yields an error with ESLint
"extends": "../tsconfig.json"
}

View File

@ -61,6 +61,13 @@ if (process.platform === 'win32') {
__dirname = __dirname.slice(1);
}
const tsConfig = {
compilerOptions: {
allowImportingTsExtensions: true,
noUncheckedIndexedAccess: false,
},
};
const esBuildOptions = {
supported: {
'top-level-await': true,
@ -120,6 +127,9 @@ export default defineNuxtConfig({
},
compatibilityDate: '2024-07-06',
nitro: {
typescript: {
tsConfig,
},
rollupConfig: {
external: [
'canvas',
@ -220,12 +230,7 @@ export default defineNuxtConfig({
typescript: {
typeCheck: !process.env.RUN_SNAPSHOT_TESTS &&
(process.env.APP_ENV || process.env.NODE_ENV) !== 'production',
tsConfig: {
compilerOptions: {
baseUrl: './',
allowImportingTsExtensions: true,
},
},
tsConfig,
},
postcss: {
plugins: {
@ -235,6 +240,11 @@ export default defineNuxtConfig({
},
},
hooks: {
'prepare:types'({ nodeTsConfig, sharedTsConfig }) {
// somewhy, allowImportingTsExtensions is ignored in Nuxt
nodeTsConfig.compilerOptions = { ...nodeTsConfig.compilerOptions, ...tsConfig.compilerOptions };
sharedTsConfig.compilerOptions = { ...sharedTsConfig.compilerOptions, ...tsConfig.compilerOptions };
},
async 'pages:extend'(routes) {
for (const code of codes) {
for (const subroute of configByLocale[code].nouns.subroutes || []) {