How to find out at runtime if a variable of type any implements an interface?
interface A{
member:string;
}
var a:any={member:"foobar"};
if(a instanceof A) alert(a.member);
If you enter this code in the typescript playground, the last line will be marked as an error, "The name A does not exist in the current scope". I even tried changing the variable declaration but even that did not work out well. I could not find anything useful on the web and so I am posting this question.
I understand that javascript as a dynamic language has no concept of interfaces. Is there any way to type check for interfaces?
The typescript playground's autocompletion reveals that typescript even offers a method implements. How can I use it ?