In a medium saucepan, combine the granulated sugar, cornstarch, and salt. Whisk them together until well blended.
In a separate bowl, whisk together the egg yolks and then gradually add the whole milk and coconut milk to the egg yolks, stirring until smooth.
Slowly pour the egg mixture into the saucepan with the sugar and cornstarch. Whisk continuously over medium heat until the mixture thickens and begins to bubble, about 7-10 minutes.
Once thick, remove the saucepan from heat and stir in the butter, vanilla extract, and shredded coconut until fully combined.
Pour the coconut custard filling into the pre-baked pie crust, smoothing the top with a spatula. Cover the pie with plastic wrap and refrigerate for at least 4 hours or until set.
Once the pie is set, prepare the whipped cream by beating the heavy cream, powdered sugar, and vanilla extract in a mixing bowl until soft peaks form.
Spread the whipped cream over the cooled coconut filling, then garnish with toasted coconut flakes if desired.
Slice and serve your old-fashioned coconut cream pie chilled.