The Imams عليه السلام do have the knowledge of what was and will be, and that nothing is unknown to them عليه السلام

Al-Kāfi|Volume 1|Book 4|Chapter 48
Al-Kāfi

Book 4, Chapter 48

The Imams عليه السلام do have the knowledge of what was and will be, and that nothing is unknown to them عليه السلام

2ـ عِدَّةٌ مِنْ أَصْحَابِنَا عَنْ أَحْمَدَ بْنِ مُحَمَّدٍ عَنْ مُحَمَّدِ بْنِ سِنَانٍ عَنْ يُونُسَ بْنِ يَعْقُوبَ عَنِ الْحَارِثِ بْنِ الْمُغِيرَةِ وَعِدَّةٍ مِنْ أَصْحَابِنَا مِنْهُمْ عَبْدُ الاعْلَى وَأَبُو عُبَيْدَةَ وَعَبْدُ الله بْنُ بِشْرٍ الْخَثْعَمِيُّ سَمِعُوا أَبَا عَبْدِ الله (عَلَيْهِ السَّلام) يَقُولُ إِنِّي لاعْلَمُ مَا فِي السَّمَاوَاتِ وَمَا فِي الارْضِ وَأَعْلَمُ مَا فِي الْجَنَّةِ وَأَعْلَمُ مَا فِي النَّارِ وَأَعْلَمُ مَا كَانَ وَمَا يَكُونُ قَالَ ثُمَّ مَكَثَ هُنَيْئَةً فَرَأَى أَنَّ ذَلِكَ كَبُرَ عَلَى مَنْ سَمِعَهُ مِنْهُ فَقَالَ عَلِمْتُ ذَلِكَ مِنْ كِتَابِ الله عَزَّ وَجَلَّ إِنَّ الله عَزَّ وَجَلَّ يَقُولُ فِيهِ تِبْيَانُ كُلِّ شَيْ‏ءٍ.
2. A number of our people has narrated from Ahmad ibn Muhammad ibn Sinan from Yunus ibn Ya‘qub from al-Harith ibn al-Mughirah and a group of our people, among whom were ‘Abd al-A‘la’, abu ‘Ubaydah and ‘Abdallah ibn Bishr al-Khath‘ami, who have said that they heard abu ‘Abdallah عليه السلام say the following. “I certainly know what is the heavens and what is in the earth. I know what is in paradise and what is the fire. I know what was there and what will be there.” The narrator has said that the Imam عليه السلام paused for a while and found that what he had just said was much heavy for the audience then he عليه السلام said, “I learned all of it from the book of Allah, the Most Holy, the Most High. Allah, the Most Holy, the Most High, has said, “In it there is the clarification of all things.”
  • Allamah Baqir al-Majlisi
    Mirʾāt al-ʿUqūl fī Sharḥ Akhbār Āl al-Rasūl (3/130)
  • Shaykh Baqir al-Behbudi
    Ṣaḥīḥ al-Kāfī