Language: TypeScript
I program in JavaScript, because I value isomorphic code (using the same code on the client and the server), being able to implement server-side rendering more easily, and programming in only one language in general. In terms of flavor, I prefer TypeScript (93% satisfaction) over vanilla ES6, because static typing catches a lot of bugs before they happen.
Might change soon? Very Unlikely#
SetupTypeScript is automatically configured by Next, but we need to install it as a dev dependency:
- Yarn
- NPM
I also often end up installing ts-node
to execute TS files, or ts-node-dev
to restart the Node process on file changes while developing, both in transpile-only mode.
I also set an absolute path for imports:
Which allows me to import files this way:
Pick whatever symbol you like. A lot of people use @/
but I find it confusing because scoped packages also start with @
.
It is natively supported by Next, but if you are not using Next, you might need tsconfig-paths to get those paths to work with Node, ts-node
, and ts-node-dev
:
Note: If ts-node
is used in production, it should have the --transpile-only
flag.
I also set module
to commonjs
for a broader compatibility with NPM modules:
#
AlternativesI find TypeScript more reliable than Flow, and it has a much bigger community and support. I would recommend Python to someone learning the fundamentals of programming though.