For example, I want to check if an object has the following format
interface InterA = { a: {
b: {
c: string //Always has this
// May have other properties here as well, like d: number, e: string
}
d: string //Always has this as well
}
I would want it to recognize that this object is of that type.
{ a: {
b: {
c: 'Always exists'
d: 'Exists this time
e: 42
}
d: 'Also always exists'
}
I want to check if an object is an instanceof that object, and return the object and all its parameters, not just the ones defined in the interface. I was thinking the best way to do this was to use a type guard or have the function tests for a but couldn't get either of them to work. What would be the best way to do this?