1. TypeScript

What Is TypeScript

TypeScript may be a typed superset of JavaScript that compiles on to JavaScript code. TypeScript files commonly use the .ts extension.

Many IDEs support TypeScript with none other setup required, but TypeScript also can be
compiled with the TypeScript Node.JS package from the command line., which means that all JavaScript code is valid TypeScript code. TypeScript adds a lot of new features on top of that.

TypeScript makes JavaScript more sort of a strongly-typed, object-oriented language like C# and Java.

This means that TypeScript code tends to be easier to use for giant projects which code tends to be easier to know and maintain.The strong typing also means the language can (and is) precompiled which variables can’t be assigned values that are out of their declared range.

For instance, when a TypeScript variable is said as a number, you can’t assign a text value thereto .

This strong typing and object orientation makes TypeScript easier to debug and maintain, and people were two of the weakest points of standard JavaScript.

Hello World Program In TypeScript

class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet(): string {
return this.greeting;
}
};
let greeter = new Greeter("Hello, world!");
console.log(greeter.greet());

Explaination

Here we’ve a category , Greeter, that features a constructor and a greet method. we will construct an instance of the class using the new keyword and pass during a string we would like the greet method to output to the console.

The instance of our Greeter class is stored within the greeter variable which we then us to call the greet method.

If you like this post, don’t forget to share πŸ™‚

This article is written by our awesome writer
Comments to: What Is TypeScript

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

New Dark Mode Is Here

Sign In to access the new Dark Mode reading option.

Join our Newsletter

Get our monthly recap with the latest news, articles and resources.

By subscribing you agree to our Privacy Policy.

Latest Articles

Explore Tutorials By Categories

About

Codeverb is simply an all in one interactive learning portal, we regularly add new topics and keep improving the existing ones, if you have any suggestions, questions, bugs issue or any other queries you can simply reach us via the contact page

Login

Welcome to Codeverb

Ready to learn something new?
Join Codeverb!

Read Smart, Save Time
  •  
    Strength indicator
  •  
  •  
    Log In | Lost Password