diff --git a/generate.js b/generate.js index e3165944..96b7a44e 100755 --- a/generate.js +++ b/generate.js @@ -162,6 +162,7 @@ function cli (args) { template.devDependencies.c8 = cliPkg.devDependencies.c8 template.scripts.test = 'npm run build:ts && tsc -p test/tsconfig.json && FASTIFY_AUTOLOAD_TYPESCRIPT=1 node --test --experimental-test-coverage --loader ts-node/esm test/**/*.ts' + template.scripts.dev = 'NODE_OPTIONS="--experimental-strip-types" FASTIFY_AUTOLOAD_TYPESCRIPT=1 fastify start -l info src/app.ts' } } else { template = { ...javascriptTemplate } diff --git a/templates/app-ts-esm/src/app.ts b/templates/app-ts-esm/src/app.ts index 74d9ff01..c157550c 100644 --- a/templates/app-ts-esm/src/app.ts +++ b/templates/app-ts-esm/src/app.ts @@ -1,6 +1,6 @@ import * as path from 'node:path' -import AutoLoad, { AutoloadPluginOptions } from '@fastify/autoload' -import { FastifyPluginAsync } from 'fastify' +import AutoLoad, { type AutoloadPluginOptions } from '@fastify/autoload' +import { type FastifyPluginAsync } from 'fastify' import { fileURLToPath } from 'node:url' const __filename = fileURLToPath(import.meta.url) diff --git a/templates/app-ts-esm/src/plugins/sensible.ts b/templates/app-ts-esm/src/plugins/sensible.ts index 5be2c8a9..c8c54a3c 100644 --- a/templates/app-ts-esm/src/plugins/sensible.ts +++ b/templates/app-ts-esm/src/plugins/sensible.ts @@ -1,5 +1,5 @@ import fp from 'fastify-plugin' -import sensible, { FastifySensibleOptions } from '@fastify/sensible' +import sensible, { type FastifySensibleOptions } from '@fastify/sensible' /** * This plugins adds some utilities to handle http errors diff --git a/templates/app-ts-esm/src/routes/example/index.ts b/templates/app-ts-esm/src/routes/example/index.ts index 68a0ea13..f32eb445 100644 --- a/templates/app-ts-esm/src/routes/example/index.ts +++ b/templates/app-ts-esm/src/routes/example/index.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const example: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) { diff --git a/templates/app-ts-esm/src/routes/root.ts b/templates/app-ts-esm/src/routes/root.ts index 27918c71..9537d9c7 100644 --- a/templates/app-ts-esm/src/routes/root.ts +++ b/templates/app-ts-esm/src/routes/root.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const root: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) { diff --git a/templates/app-ts-esm/tsconfig.json b/templates/app-ts-esm/tsconfig.json index cd4a3e52..83162f9b 100644 --- a/templates/app-ts-esm/tsconfig.json +++ b/templates/app-ts-esm/tsconfig.json @@ -1,12 +1,13 @@ { - "extends": "fastify-tsconfig", "compilerOptions": { "outDir": "dist", - "sourceMap": true, - "moduleResolution": "NodeNext", - "module": "NodeNext", - "target": "ES2022", - "esModuleInterop": true + "sourceMap": true, + "target": "esnext", + "module": "nodenext", + "allowImportingTsExtensions": true, + "rewriteRelativeImportExtensions": true, + "verbatimModuleSyntax": true, + "erasableSyntaxOnly": true }, "include": ["src/**/*.ts"] -} +} \ No newline at end of file diff --git a/templates/app-ts/src/routes/example/index.ts b/templates/app-ts/src/routes/example/index.ts index 68a0ea13..f32eb445 100644 --- a/templates/app-ts/src/routes/example/index.ts +++ b/templates/app-ts/src/routes/example/index.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const example: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) { diff --git a/templates/app-ts/src/routes/root.ts b/templates/app-ts/src/routes/root.ts index 27918c71..9537d9c7 100644 --- a/templates/app-ts/src/routes/root.ts +++ b/templates/app-ts/src/routes/root.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const root: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) {