Scald the milk: In a saucepan, heat the milk over medium heat until it simmers around the edges. Remove from heat and set aside.
Whisk the egg yolks: In a bowl, whisk the egg yolks and sugar together until light and frothy.
Combine wet and dry ingredients: Gradually whisk the hot milk into the egg yolk mixture, whisking constantly to prevent the eggs from scrambling.
Cook the custard: Return the mixture to the saucepan and cook over medium heat, stirring constantly with a whisk, until the custard thickens and coats the back of the spoon.
Add vanilla and salt: Remove the saucepan from the heat and stir in the vanilla extract and salt.
Strain (optional): For a smoother pastry cream, strain the mixture through a fine-mesh sieve into a bowl.
Chill: Cover the pastry cream with plastic wrap, pressing the wrap directly onto the surface to prevent a skin from forming. Refrigerate for at least 2 hours before using.