Appearance
TypeScript 提供类型断言和类型守卫提升类型安全。
let someValue: any = 'hello'; let strLength: number = (someValue as string).length;
function isString(x: any): x is string { return typeof x === 'string'; }
类型断言和守卫让代码更健壮。