Reputation: 31
I want to check if two interfaces are equal at runtime and then execute some code. I noticed a library conditional-type-checks that can compare types and returns a true or false type, but I am unsure of how to use it for my case.
This is what I have so far
type IDialogUnchanged = IsExact<IDialog, IDialogOrig>;
which returns a true or false type
Upvotes: 2
Views: 1471
Reputation: 107
Short: You can't. But they are hacks/workarounds/ways that can give you similar results, if you can change your requirements.
Long: Interfaces doesn't exists at run-time, so there is no way you can extract data about its members and/or compare them. Interfaces are design time tools, for you, for auto-complete etc. They vanish on run-time. However, there are few other options.
Hope you can work you way out. If not, please provide more details or provide that library's name. Regards.
Upvotes: 3