Cast an object to other type using Typescript. How? And instanceof or typeof?
Something like this:
let object = myObject as string; // this way
let object = <string> myObject; // or this way
In addition, instanceof
returns a boolean, typeof
returns the instance type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With