ObjectIdByType<T extends ObjectType> = Extract<Obj, { objectType: T }>["id"]into a mapped type using the object type as key, i.e.
ObjectIdByType = {
[K in ObjectType]: Extract<Obj, { objectType: K }>["id"]
}and replacing ObjectIdByType<T> with ObjectIdByType[T].
