const variableSample: number = 0;
let variableSample: number = 0;
type Person = {
name: string;
age: number;
};
const person: Person {
named: 'Rex'
age: 23
}
function greet(person: Person) {
return "Hello " + person.name;
}
let name: string; // stores text
let age: number; // stores numbers
let isMale: boolean; // stores a true or false values
let typeAny: any; // stores any type of value
let typeNull: null = null; // can only store a null value
let typeUndefined: undefined = undefined; // can only store undefined value
// these are the basic types of variables in TypeScript
// and of course you can change let to const
var name: string = 'Bulbul';
const age: number = 34;
let email: string = 'bulbul.cse@outlook.com';
interface Person {
name: string;
age: number;
}
const person:Person {
name: "Rex",
age: 20
}
function greet(person: Person) {
return "Hello " + person.name;
}