Basic types

TypeScript supports a handful of built-in types; the following are examples of the most common ones:

const fullName: string = "John Doe";
const age: number = 6;
const isDone: boolean = false;
const d: Date = new Date();
const canBeAnything: any = 6;

As you can see, TypeScript supports basic primitive types such as string, number, boolean, and date.

Another thing to notice is the type any. The any type is a valid TypeScript type that indicates that the declaration can be of any given type and all operations on it should be allowed and considered safe.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.121.8