Added TypeId and helper class

Also moved definitions of component and event so we could remove those
headers.