Custom types of guards and instanceofType of protection does not narrow the types that are any(including union and intersection c any).
The only thing that will narrow down the anytype defender is to use validation typeofand validation for the primitive string, booland number:
var something: any;
if (typeof something === "string")
{
something.NonExistant();
something.substr(0, 10);
}
typeof, function, object undefined, any, , .
, any , TS 2.0.
,
, -, , - , , , , . - any , , any, , .
, , , TypeScript any , .
, , object any, .