How TypeScript is optionally statically typed language?

Technology CommunityCategory: TypeScriptHow TypeScript is optionally statically typed language?
VietMX Staff asked 3 years ago

TypeScript is referred as optionally statically typed, which means you can ask the compiler to ignore the type of a variable. Using any data type, we can assign any type of value to the variable. TypeScript will not give any error checking during compilation.

Consider:

var unknownType: any = 4;
unknownType = "Okay, I am a string";
unknownType = false; // A boolean.