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 - Function Examples

Old Boring Way


function BoringFunction(arg1, arg2)
{
    // code here
}

What's it output? Void? Some value? What about the arguments? Are the nullable? Strings, ints, objects?

New, coolness way


function CoolFunction(arg1: string, arg2?: string) : string
{
    // I do stuff and return a string. Arg2 is optional.
}

Example 1
Example 2
Example 3
Example 4
Example 5
Example 6