Basics

Challenges

Classes

Cookies

Debugging

Events

External Files

Flow Control

Forms

Functions

Html Elements

Installation

Interfaces

Keywords

Modules

Namespaces

Operators

Reference Files

String

Types

TypeScript - Simple Example

What is TypeScript

TypeScript is very much like C# or any other OOP language. This simple Class has a property. The Constructor requires an argument of type String and the function “greet” returns the message + "Hello". It supports encapsulation and Static Typing.


class Greeter
{
    Greeting: string = "";

    constructor (message: string)
    { this.Greeting = message;}

    Greet()
    {
        return "Hello" + this.Greeting;
    }
}