Warm the coconut milk in a saucepan over a medium heat until it starts to bubble. Meanwhile, whisk the sugar, egg yolks and cornflour together until light and creamy, then pour in the warm coconut milk while still whisking. Pour back into the pan and cook over a low heat for about 5-8 minutes, until thickened enough to coat the back of a spoon (when you run your finger across the custard on the spoon, it should leave a clean line).
*The cornflour is optional but i added it the second time I made it, and it improved the consistency. I recommend it, especially if using light coconut milk, even though I don't use it in ordinary custard.