This example is presented purely for illustrative purposes and should not be considered a real-world scenario.
function myCustomFunc<A extends string, B extends string>(str1: A, str2: B): string {
return "";
}
How can we ensure that A
and B
are distinct in order to prevent calling myCustomFunc
with identical values like
myCustomFunc("Example", "Example")
?