Check out example codes for "function overload in ts". It will help you in understanding the concepts better.

Code Example 1

Overloaded Funcitons:
	Set of different functions which have same name.

type Both = string | number;

function add(a: number, b: number): number;
function add(a: string, b: string): string;
function add(a: Both, b: Both) {
  if (typeof a === 'string' || typeof b === 'string') {
    return a.toString() + b.toString();
  return a + b;

const res = add('Joyous ', '21');

Learn ReactJs, React Native from