Place a mixing bowl on your countertop. Measure and whisk together the egg yolks in the bowl until smooth and slightly pale.
3 large egg yolks
In a saucepan over medium heat, combine coconut milk, sugar, and cornstarch. Whisk constantly until the mixture begins to thicken and just starts to simmer, about 5 minutes. You should see steam rising and the mixture coating the back of a spoon.
1 1/2 cups coconut milk, 1/2 cup granulated sugar, 3 tablespoons cornstarch
Gradually pour half of the hot coconut mixture into the bowl with the whisked egg yolks, whisking constantly to temper the eggs and prevent curdling.
1 1/2 cups coconut milk, 3 large egg yolks
Pour the tempered egg mixture back into the saucepan with the remaining coconut mixture. Cook over low heat, stirring constantly, until the filling thickens noticeably and starts to cling to the sides of the pan, about 3 minutes.
Remove from heat and stir in the butter, vanilla extract, and shredded coconut until smooth and well combined.
2 tablespoons butter, 1/4 cup unsweetened shredded coconut
Pour the coconut custard into the baked and cooled pie crust. Spread evenly and smooth the surface with a spatula. Refrigerate for at least 2 hours to set. Before serving, sprinkle with toasted coconut if desired for added crunch and flavor.
optional toasted coconut