for example:
interface A {
a: number
}
interface B {
a: number
b: string
}
const X = (x) => {
//
return x
}
The parameter x may be An or B.
if type An is passed in, you want to check that x is returned after the operation, and if you have the attribute b, it is an error.
if type B is passed in, you want to check that x is returned after the operation, and it is an error without attribute b.
you want to return the type of x, and the assertion is equal to the type passed in.