score:2

Accepted answer
type TypeA = {
    a: string
    b: string
    c: object
}
type TypeB = {
    a: string
    b: string
}

const f = (passed: TypeA | TypeB) => {
    console.log(passed.a)
    if ('c' in passed) {
        console.log(passed.c)
    }
}

Related Query

More Query from same tag