I have an interface similar to this:
interface ISomething<TMulti extends object> {
value: number | string;
text: string | TMulti;
}
The text part could either be a simple string or an object map implementing some specific interface. In majority of cases it's going to be just a simple non-nullable string, so I would like to set the TMulti generic type default to something to east the use of this interface. My choices are
{}nullnever
The best option seems to be never but I've never seen it used as a generic type default and am not exactly sure what a type of string | never actually means? Is it identical to string? Both of the other two options, allow me to set the value of text to some undesired value.
The question is: can type never be used as a generic type default and what does it mean is such case?
Additional note: I'm using Typescript in strict mode, so
stringcan't be null per compiler requirements, which is also what I want.