Comp 110 TypeScript Syntax

TypeScript Language Constructs

Comment out content.

//This is a comment!
/* This is also a comment! */

Primitive types.

boolean, number, string

Declare a variable.

let <name>: <type>;

Initialize a variable.

<name> = <value;

Declare and initialize a variable together.

let <name>: <type>;

Declare an array. (Type is implied by the contents of the array. If multiple types are provided, array will be of type 'any.')

let <name>: <type>[] = [];
//This is currently initialized to be an empty array

Test Equality

<value> === <value>

Declare a function.

export let <function name> = async () => {