function doSomething(a : any) {
let b = (a as Array<any>)
alert(typeof b) // displays "string"
}
doSomething("Hello")
The alert is showing "string" instead of what I anticipated, which was something along the lines of a null
value. The documentation on the as
operator seems to be scarce. Perhaps you can refer to this link for more information.
You might also find this related question helpful.
Do I still need to manually check the type of variable b
?