In a large saucepan, mix sugar, cornstarch, cocoa powder, and salt.
Pour in a small amount of milk. Whisk until well combined and smooth.
Add egg yolks if desired and whisk until mixed.
Place saucepan over medium heat, stirring constantly.
Bring to a boil, then boil for 1 minute, until mixture begins to thicken. Remove from heat.
Add butter, vanilla, and optional chocolate chips. Stir until melted.
Stir while warm, or chill and serve. Top with whipped topping if desired. Enjoy!