TypeScript 不符合直觉的点汇总

// based on ts v4.9.5

type Sth = {
    name: string
}

const b: any = 2
const a: Sth = {
    ...b && {name: 1} // b was any, and type checking not work 
}

const b2: number = 2
const a2: Sth = {
    ...b2 && {name: 1} // b was a concrete type, and type checking  works
}