Type Assertions in TypeScript
Type Assertions is the process of manually specifying data types. There are two formats. as Example 1: Using the as format. let data1:unknown; data1="Apple"; let fruit = (data1 as string).toLowerCase(); console.log(fruit); Example 2: Using the format. let data1:unknown; data1="Apple"; let fruit = (data1).toLowerCase(); console.log(fruit);

Type Assertions is the process of manually specifying data types. There are two formats.
as
Example 1: Using the as
format.
let data1:unknown;
data1="Apple";
let fruit = (data1 as string).toLowerCase();
console.log(fruit);
Example 2: Using the format.
let data1:unknown;
data1="Apple";
let fruit = (data1).toLowerCase();
console.log(fruit);