This is a question that parents frequently ask in my clinic. And most everyone agrees that it is a good idea to tell the child. Many children on the spectrum already know they are different and if they know their diagnosis then they understand why they are different and they are usually relieved and will accept therapy. And the consensus is that they should be told early.
When I tell parents this they tell me that they are afraid that when a child learns of their diagnosis it will lower, maybe even destroy their self-esteem. Actually though, the child's self-esteem seems to improve because they have their diagnosis to blame for their problems which they see separately from themselves.
At what age a child is told varies and how much you tell a child also varies. Most experts recommend the earlier the better and all the information about their diagnosis should not be given at one time. There are books available to help parents plan their approach. Just Google this blog's title.