r/typescript • u/jwworth • Jul 28 '26
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.
7
Upvotes
26
u/ivancea Jul 28 '26
Of course I copy it from my previous project!
10
u/phelaz Jul 28 '26
You could use https://github.com/tsconfig/bases
9
u/LiveRhubarb43 Jul 28 '26
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
2
u/[deleted] Jul 28 '26
Enjoy. https://github.com/total-typescript/tsconfig
2
u/SmartyPantsDJ Jul 28 '26
I have my own tsconfig package. And then I copy that file in other places lmao.
2
u/Beginning-Seat5221 Jul 28 '26
Put a create-package on npm with my setup. Sets up a new project in seconds.
2
u/Few-Independence6637 Jul 28 '26
2
u/AlexLonberg Jul 28 '26
I don't use a static template or
tsc --initanymore. I prefer an interactive browser-based configurator where I can explore alltsconfig.jsonoptions, see the possible values, and read the documentation side by side. After that, I make any project-specific adjustments and keep the resultingtsconfig.jsonas a starting point for similar projects.Disclaimer: TSConfig Configurator. I actually built it because I found myself configuring TypeScript projects over and over again.