xxxxxxxxxx
let x:unknown = "abcder";
console.log((x as string).length)
/*we turn something into a string*/
xxxxxxxxxx
// Original syntax
var markerSymbolInfo = <MarkerSymbolInfo> symbolInfo;
// Newer additional syntax
var markerSymbolInfo = symbolInfo as MarkerSymbolInfo;
xxxxxxxxxx
// Typecasting (or type assertion) in TypeScript allows you to treat a variable as a different type than its inferred type.
// Option 1: Using the "as" keyword
let myVariable: any = "Hello World";
let length: number = (myVariable as string).length;
// Option 2: Using the angle bracket syntax
let myVariable: any = "Hello World";
let length: number = (<string>myVariable).length;
xxxxxxxxxx
return this.createMarkerStyle(symbolInfo as MarkerSymbolInfo);