"That He may know that they have conveyed the messages of their Lord." That is, so that the messenger may know that the messengers before him have conveyed the messages of their Lord. "And He has encompassed what is with them," meaning: that with which they were sent, so that nothing can reach them until they have conveyed the message from Allah. "And He has counted everything" of His creation "in number."
Muhammad said: "In number" is a circumstantial qualifier (hal). The meaning is: And He has counted everything in terms of number.
﴿لِيَعْلَمَ أَنْ قَدْ أَبْلَغُوا رِسَالاتِ رَبهم﴾ لِيَعْلَمَ ذَلِكَ الرَّسُولُ أَنَّ الرُّسُلَ قَبْلَهُ قَدْ بلَّغوا رِسَالاتِ رَبِّهِمْ ﴿وأحاط﴾ ﴿الله﴾ (بِمَا لديهم﴾ يَعْنِي: مَا أُرْسِلُوا بِهِ فَلا يُوصَلُ إِلَيْهِمْ؛ حَتَّى يُبَلِّغُوا عَنِ اللَّهِ الرِّسَالَةَ ﴿وَأَحْصَى كُلَّ شَيْءٍ﴾ ﴿من خلقه﴾ (عددا﴾.
قَالَ محمدٌ: (عددا) حَالٌ؛ الْمَعْنَى: وأَحْصَى كُلَّ شَيْءٍ فِي حَالِ الْعَدَدِ.