1. Whisk egg yolks until smooth in a large bowl.
2. Combine sugar, cornstarch, and salt in a medium saucepan, and heat over medium. Stirring constantly, gradually add milk in a slow, steady stream, and cook until mixture thickens and begins to bubble, about 5 minutes.
3. Whisking constantly, slowly pour one third of the milk mixture into egg yolks (this step is called tempering, which keeps the yolks from curdling). Pour mixture into remaining milk mixture in saucepan. Cook over medium heat, whisking constantly, until mixture comes to a full boil and is thick enough to hold its shape when lifted with a spoon, 2 to 4 minutes. Remove from heat; stir in vanilla.
4. Strain mixture through a fine sieve into a heatproof bowl. Cover with parchment paper or plastic wrap, pressing it directly on surface to prevent a skin from forming. Refrigerate until chilled and firm, at least 2 hours (or up to 2 days). Once cupcakes are cooled, remove the center of the cupcakes and fill each cupcake with about a tablespoon of the chilled pastry cream. Replace the top of the cupcake.