diff --git a/packages/nuxt/src/core/nitro.ts b/packages/nuxt/src/core/nitro.ts index 7c13f7e848..9528d734e6 100644 --- a/packages/nuxt/src/core/nitro.ts +++ b/packages/nuxt/src/core/nitro.ts @@ -92,7 +92,9 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { layer => resolve(layer.config.srcDir, 'app.config') ), typescript: { - generateTsConfig: false + strict: true, + generateTsConfig: true, + tsconfigPath: 'tsconfig.server.json' }, publicAssets: [ nuxt.options.dev diff --git a/test/fixtures/basic/server/api/useAsyncData/count.ts b/test/fixtures/basic/server/api/useAsyncData/count.ts index 8cdb1c14aa..b529bb034c 100644 --- a/test/fixtures/basic/server/api/useAsyncData/count.ts +++ b/test/fixtures/basic/server/api/useAsyncData/count.ts @@ -1,3 +1,9 @@ let counter = 0 +const test = () => () => { + // TODO: useNuxtApp should be undefined when type-testing a nitro route + useNuxtApp() +} +test() + export default defineEventHandler(() => ({ count: counter++ })) diff --git a/test/fixtures/basic/server/tsconfig.json b/test/fixtures/basic/server/tsconfig.json new file mode 100644 index 0000000000..b9ed69c19e --- /dev/null +++ b/test/fixtures/basic/server/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../.nuxt/tsconfig.server.json" +}