Classes in TypeScript

We’ve already briefly looked at classes in TypeScript and classes in JavaScript, so let’s delve a little deeper now. Since TypeScript is just JavaScript, with some added on bits, we can create a class as we normally would with the adding of types as you see below. However, we can overload our constructors to see…

What is tsconfig.json for?

The tsconfig.json file specifies the root files and the compiler options required to compile a TypeScript project. So presence of a tsconfig.json file in a directory indicates that the directory is the root of a TypeScript project. Without that file, the compiler will continue to move up the directory hierarchy to fine the config file. There is also a…

Strictness of Types

People, when they come to TypeScript, might have different ideas in mind with how strict they want types checked. Some people don’t want types at all, like JavaScript currently is, and want to use other aspects of TypeScript, while others might want to be very strict. The default experience with TypeScript, where types are optional,…

Custom Data Types in TypeScript

We’ve already seen the standard data types in JavaScript and TypeScript. However, JavaScript allows for class, and we want to therefore be able to define a custom data type within TypeScript. Since JavaScript supports classes and object-oriented programming, so does TypeScript. You can explicitly describe this object’s shape using an interface declaration. Then, to define an object…