I looked everywhere and couldn't find any way to check if a given object is of some custom type or not. For example, I declare type Human as such:
type A = { name: string; age: number; }
Then I want to have a function that will receive an object and decided whether it's of type Human or not. Something like:
isOfTypeHuman = (input) => typeof input === Human
I have a feeling it's impossible, but I thought maybe I'm missing something. Any ideas?
Ato be used asA. However, if you have an object of unknown shape, then you can only duck type it.employeeIdit doesn't mean it's not a human. Just a different type.