Add the milk to a medium saucepan and heat over medium heat until hot and steaming, but do not bring it to a full boil.
While the milk heats, whisk the egg yolks, sugar, cornstarch, and salt in a medium bowl until completely smooth.
Slowly pour a small amount of the hot milk into the egg yolk mixture while whisking constantly. Continue adding the hot milk very gradually while whisking until fully incorporated. Adding the milk slowly will temper the eggs and prevent them from scrambling.
Pour the mixture back into the saucepan and cook over medium-low to medium heat, whisking constantly, until the pastry cream thickens and begins to gently bubble.
Continue whisking for about 1 minute, then remove from the heat and stir in the vanilla extract.
For an extra-smooth pastry cream, pour it through a fine-mesh sieve into a clean bowl.
Press plastic wrap directly against the surface of the pastry cream to prevent a skin from forming.
Refrigerate for at least 2 hours or until completely chilled and set.