In [1]:
let _id; // Implicit Declearation
let fb_id: any; // Explicit Declearation
fb_id = true;
fb_id = 23423523;
const firstName = "Riyad";
const lastName: string = "Hossain";
let isLoading: boolean;
isLoading = false;
let roll: string | number = 423;
roll = "423";
let device: string | number | boolean; // Union Type
device = "Mobile";
device = 4323523;
const re: RegExp = /\w+/g;
console.log("hello")
hello
In [2]:
interface Point {
x: number;
y: number;
}
function logPoint(p: Point) {
console.log(`${p.x}, ${p.y}`);
}
// logs "12, 26"
const point = { x: 12, y: 26 };
logPoint(point);
12, 26