I have multiple objects in my app. For example:
interface Recipe {
title: string,
ingredients: []
creator: string,
// ...
}
interface Vendor {
name: string
address: Address
// ...
}
The user should have the ability to create objects that can accept any of these interfaces for example:
interface Event<T> {
date: Date(),
type: T // This should be of type Recipe or Vendor object for example.
}
- What is the proper way to define this?
- How would I then find out which object the user passed?
Thank You!