Typescript

TypeScript Resources

We have compiled a list of free and paid TypeScript resources. Official Documentation It’s always advisable to refer to and follow the official documentation available at https://www.typescriptlang.org/docs/ Online Courses Below are a few top-rated courses (Rating 4.7⭐ at the time of writing this section) on TypeScript. Understanding TypeScript – 2021 Edition  TypeScript for Beginners 2022  …

TypeScript Resources Read More »

TypeScript Build Tools

Build tools are programming utilities that help to automate the transformation and bundling of our source code into a single file. Building means compiling, linking, and packaging the code into the executable form. There are several common build tools available that can be integrated with TypeScript. The Build tools are usually run on the command …

TypeScript Build Tools Read More »

TypeScript Generics

In this section, we will learn about Typescript Generics. Generics in Typescript is no different than generics in other programming languages like C# or Java. You can create a class, an interface, or a function that works with different types, without specifying the type upfront. TypeScript Generics Syntax Let’s create a function with generic type: …

TypeScript Generics Read More »

TypeScript Modules

By default, the typescript code is in the global scope. If we have multiple files in a project, the variables, functions, etc. written in one file are accessible in all the other files. TypeScript provides modules and namespaces in order to prevent the default global scope of the code and also to organize and maintain …

TypeScript Modules Read More »

TypeScript Namespace

Using namespace we can group logically related code. This is built into typescript, unlike javascript. A namespace can include classes, interfaces, functions, and variables. We can create a namespace in typescript using namespace keyword followed by any valid name. For Example: namespace MyNamespace { } If we want the members of the namespace to be …

TypeScript Namespace Read More »

TypeScript Access Modifiers

There are 3 types of access modifiers in TypeScript, TypeScript Access Modifiers are: public, private, and protected. 1. Public By default, all the members of a class are public in TypeScript. 2. Private When any of the class members are declared private, it is only accessible within the class scope. 3. Protected The protected members are similar …

TypeScript Access Modifiers Read More »

TypeScript Data Types

Types can be divided into 3 categories – Any, Built-in, and User-defined. To assign a type in Typescript, you need a colon: then the name of the type, an equal sign =, and the value of that variable. For example: let name: String = “DotNetCrunch”; 1. Any This is the superset for all the data types available. It means …

TypeScript Data Types Read More »

TypeScript Variables

TypeScript follows the same rules as JavaScript for variable declarations. TypeScript variables can be declared using: var, let, and const. Var Similar to JavaScript, we can declare variables in TypeScript using the var keyword. The scoping rules also remain the same as in JavaScript. Let The let declarations follow the same syntax as var declarations. Unlike variables …

TypeScript Variables Read More »

TypeScript Hello World

TypeScript Hello World Console Now that we have installed TypeScript successfully, Let’s start with our first typescript program – TypeScript Hello World. Open any editor of your choice and type the code given below: File: helloworld.ts function greeting(input){ return “Hello, ” + input; } let message = “World”; console.log(greeting(message)); The typescript code would be transpiled …

TypeScript Hello World Read More »