I have problem with defined types and checking if a value is contained in that type.
Here is my example:
these are the types:
export type Key = 'features' | 'special';
export type TabTypes = 'info' | 'features' | 'special' | 'stars';
when the user changes a tab, it sends a string value from Type of TabTypes.
activeTabChanged(event: TabTypes) {
this.activeTab: TabTypes = event;
// it won't let me set the key here because key has a different type
// but the send event can be contained in type Key
// how can I check if the send event from type TabTypes is contained in type Key
this.key: Key = event;
}
is there a typescript way to check if a sent value with a type can equal a value from a different type?