How to create a custom supertype