How do I handle TypeScript casting in TypeScript or JavaScript?
I have the following TypeScript code:
module Symbology {
export class SymbolFactory {
createStyle(symbolInfo: SymbolInfo): any {
if (symbolInfo == null) {
return null;
}
if (symbolInfo.symbolShapeType === "marker") {
// How do I cast to MarkerSymbolInfo in TypeScript?
return this.createMarkerStyle((MarkerSymbolInfo) symbolInfo);
}
}
createMarkerStyle(markerSymbol: MarkerSymbolInfo): any {
throw "createMarkerStyle not implemented";
}
}
}
Where SymbolInfo is a base class. How do I handle casting from SymbolInfo to MarkerSymbolInfo in TypeScript or JavaScript? What is the correct approach for TypeScript casting in this context?