Now that we've got that subjects in on put together we're going to put together a interface that is
going to describe the very distinct coupling between this particular subject and the event data that
we expect to receive with it.
So back inside my editor once again inside the events directory.
I'm going to make a new file called Ticket created event dot t yes at the very top we're going to import
that into we just created so subjects from subjects we're then going to create an export and interface
that we're going to call ticket created events.
So again this is where we're going to set up this very tight coupling.
We're going to say that there is going to be a very tight coupling between this very specific subject
name and this structure of data.
We went to then figure out how to enforce that coupling inside of our actual listener so inside this
interface we're gonna say that we expect there to be an event at some point time that indicates that
a ticket was just created the subject for this event will be of type subject start to get created and
the data that we expect to see inside that event is going to be an idea that is a string a title that
is a string any price that is a number.
So again this is where we set up the coupling between this very specific subject and this structure
of data we're going to eventually create interfaces just like the one right here to describe all the
different types of events we eventually expect to have inside our application.
So for example we might have a ticket updated event a order created order cancels order whatever else
may we have a payment success event or payment failed event every different event we ever expect to
have inside our application.
We're going to create a different interface for it.
And again that's going to make sure that typescript can step in and make sure that we have some matching
subject and data inside of one of our custom listeners.
We put together OK.
So we've now got the listing of all the possible subjects.
We've got the interface that describes the coupling of one particular subject with the structure of
data.
Now last thing we have to do is teach typescript how to somehow do some verification and make sure that
when we put our custom listener together like this one right here we need to make sure that typescript
understands that needs to check and make sure that this subject right here matches up with the type
of data argument we have right there.
So we'll take care of that in the next video.