Whisk sugar, cornstarch, milk and yolks in a medium saucepan. Bring to a boil. Reduce heat and cook 2 minutes. Remove from heat and add vanilla and chocolate. Stir until well combined. The filling can also be used as a pie filling.
The leftover egg whites are great to use for Angel Food Cake.
Recipe by Five Wooden Spoons at https://www.fivewoodenspoons.com/2012/11/08/chocolate-pudding/