TypeScript différents types support

function getLength(obj: string | string[]) {
  return obj.length;
}
Puzzled Puffin