TypeScript
interface Item {
  id: number;
  name: string;
}

// findItem returns the matching item, or undefined if no id matches.
function findItem(items: Item[], id: number): Item | undefined {

}

// count works on an array of any type.
function count<T>(arr: T[]): number {

}

const inventory: Item[] = [
  { id: 1, name: "Mouse" },
  { id: 2, name: "Keyboard" },
];

const found = findItem(inventory, 2);
const missing = findItem(inventory, 99);
const total = count(inventory);