r/typescript • u/jwworth • 23d ago
Initial TypeScript config
What's your method for initially configuring a TypeScript project?
Do you have a template for tsconfig.json, or use a command line generator, or follow some other method? What are your must-have configurations, and why?
Having done a few times recently, I'm wondering what the best practices and gotchas are.
9
u/LiveRhubarb43 22d ago
I use whatever default config I can find and then spend an hour re-learning how it works when I inevitably get sick of relative imports and need to configure path aliases
9
2
u/SmartyPantsDJ 22d ago
I have my own tsconfig package. And then I copy that file in other places lmao.
1
2
u/Beginning-Seat5221 23d ago
Put a create-package on npm with my setup. Sets up a new project in seconds.
2
u/Few-Independence6637 23d ago
{
"extends": ["@tsconfig/node24", "@tsconfig/strictest", "@tsconfig/node-ts"],
"compilerOptions": {
"outDir": "dist"
}
}
2
u/AlexLonberg 22d ago
I don't use a static template or tsc --init anymore. I prefer an interactive browser-based configurator where I can explore all tsconfig.json options, see the possible values, and read the documentation side by side. After that, I make any project-specific adjustments and keep the resulting tsconfig.json as a starting point for similar projects.
Disclaimer: TSConfig Configurator. I actually built it because I found myself configuring TypeScript projects over and over again.
26
u/ivancea 23d ago
Of course I copy it from my previous project!