1. unknown will show errors, but any not
let a: unknown = 1
a.say() // errors: Object is of type 'unknown'.ts(2571)
let b: any = 1
b.say() // no error
2. Narrowing down the range in Union Types and Intersection Types
type r3 = unknown | string // unknown
type r4 = unknown & string // string
type r5 = any | string // any
type r6 = any & string // any
3. Narrowing down the keyof
result
type r1 = keyof unknown; // never
type r2 = keyof any; // string | number | symbol
0 Comments