TLDR Switching from relative to absolute imports in TypeScript can greatly enhance code readability and manageability. By updating the tsconfig.json settings to use a fixed path from your project's root, you can simplify import statements. Additiona...
I have come to a solution that you should always use types over interfaces. Let's breakdown why!! Interfaces can only specify objects, but type alias can specify objects and everything else. Let's say we have a single Address field and with type you...
Before starting note that I'm a JavaScript(Node js) Developer i have somewhat experience in TypeScript. Ok!! When you start your journey of learning Web development you get to know that either you have to be good at Frontend or Backend (Full stack if...
Preface This article was like that missing sock you find a year later behind the dryer — unexpected but still useful! 'Understanding TypeScript' by Gavin Beirman and his co-authors had finally surfaced and helped me get a good grasp of the language's...
In this blog, I am keeping a draft example of the modern tsconfig file that works for me in the projects that I am making. { "compilerOptions": { "target": "ESNext", "experimentalDecorators": false, "module": "commonjs", "rootDir": ...
When working with TypeScript we would want to define the type of each variable. This can be done explicitly or implicitly. To explicitly define a variable type we can write the following code // We can clearly see we define type after the colon let n...
TSConfig path aliases in TypeScript allows us to define custom aliases for module imports in our project. This means we can create shorter and more meaningful names for our module imports, rather than using long and complex relative paths. To set up ...
Typescript, as we all know, enhances the development process with its static typing and advanced features. But what happens behind the scenes when you write typescript code? How does it magically transform into browser-friendly Javascript? So, in thi...
Want to start your next project in typescript you can easily use this simple configuration file to kick-start it without wasting time { "compilerOptions": { "target": "ESNext", "useDefineForClassFields": true, "module": "ESNext", "m...
Introduction As a JavaScript/TypeScript programmer, working on a large codebase means importing a lot of things from different places. Most times your import section looks like this: import CartModal from "../../../components/cart/CartModal"; import ...