type StringOrNumber = string | number;

function combine(input: StringOrNumber, extra: StringOrNumber): StringOrNumber {
  if (typeof input === 'number' && typeof extra === 'number') {
    return input + extra;
  }

  return input.toString() + extra.toString();
}

console.log(combine(1, 'test'));

type Person = { name: string };
type Worker = { company: string };

type EmployeedPerson = Person & Worker;

const employee: EmployeedPerson = {
  name: 'Alice',
  company: 'TechCorp',
};
console.log(employee);

// const value: StringOrNumber = true

function formatInput(input: StringOrNumber): string {
  return `Eingabe: ${input}`;
}

console.log(formatInput('Test'));
console.log(formatInput(123));

function getLength(value: string | number): number {
  if (typeof value === 'string') {
    return value.length;
  }

  return value.toString().length;
}

type A = { id: string };
type B = { id: number };

type C = A & B;

// const c: C = {
//   // id: "test"
//   // id: 4,
// };
