In a medium saucepan, whisk together sugar, cornstarch, and salt.
Gradually add milk, whisking until smooth. Cook over medium heat, stirring constantly, until the mixture thickens and starts to bubble.
In a separate bowl, whisk egg yolks. Slowly add a small amount of the hot milk mixture to temper the eggs, then return the mixture to the saucepan.
Cook for 2-3 more minutes, stirring constantly, until the filling thickens further.
Remove from heat and stir in shredded coconut and vanilla extract.
Pour the filling into the cooled crust and smooth the top. Refrigerate for at least 2 hours.