I've wondered this about many passages in the New Testament particularly. Such as the angels visiting Mary, and Joseph. How did the gospel writer(s) know what was said? It was either the angel who told them or Mary. Either case has issues.
Of course, this is only an issue if one takes it all literally.
Hence, is a literal interpretation (of the Bible) truly the authors' intent?