Combine the egg yolks, sugar, salt, vanilla extract, cornstarch, and cocoa powder in a large or medium heat-proof bowl. Whisk vigorously until smooth.
Heat the milk in a saucepan on medium heat. Once it starts to bubble a bit, remove it from the heat. Be sure not to scald the milk, as it will affect the flavor of the pastry cream!
Pour half of the milk into the egg mixture, while whisking vigorously. It helps to put a towel underneath the bowl to help prevent it from sliding around!
Then, pour the egg and milk mixture into the saucepan with the rest of the milk and whisk.
Place the saucepan back on medium heat and continue to whisk. Once the mixture is heated through, it should start to thicken. Whisk for about 30 seconds, until bubbles start to break the surface.
Once the mixture has thickened, stir in chocolate chips or chopped chocolate and whisk until it is fully melted and incorporated.
Remove from heat and add the butter, whisking until it melts into the mixture.
Transfer to a bowl and cover with plastic wrap, making sure that the plastic wrap touches the surface of the cream to avoid a skin forming. Refrigerate for 1-2 hours or until cooled. Then use for filling pastries, cakes, or whatever you like!