const allCustomers: ICustomer[] = customers(); interface ICustomer { id: number; name: string; age: number; city: string; } function customers(): ICustomer[] { let id: number = 0; return [ createCustomer(id++, "Drew", 22, "Glassboro"), createCustomer(id++, "Mike", 40, "Rineyville"), createCustomer(id++, "Justin", 19, "Jonesboro"), createCustomer(id++, "Alex", 15, "Paulsboro"), createCustomer(id++, "Phil", 32, "Glassboro") ]; } function createCustomer(id: number, name: string, age: number, city: string): ICustomer { return { id, name, age, city }; } function getCustomerInformation(customers: ICustomer[], id: number): ICustomer { // Note undefined is returned if object not found return customers.find(customer => customer.id === id); }