let input = document.querySelector('input[type="text"]') as HTMLInputElement;Code language: TypeScript (typescript)
// Original syntax
var markerSymbolInfo = <MarkerSymbolInfo> symbolInfo;
// Newer additional syntax
var markerSymbolInfo = symbolInfo as MarkerSymbolInfo;
return this.createMarkerStyle(symbolInfo as MarkerSymbolInfo);
return this.createMarkerStyle(<MarkerSymbolInfo> symbolInfo);
export default function App() {
const inputRef = useRef<HTMLInputElement | null>(null);
const car: {brand:string} = {
brand: "Toyota"
}
useEffect(() => {
console.log(car.brand);
}, []);
/*basically add :{} after the object name*/
let x:unknown = "abcder";
console.log((x as string).length)
/*we turn something into a string*/