Al-Kāfi - Volume 1 > The Imams (a.s.) do have the knowledge of what was and will be, and that nothing is unknown to them (a.s.)
Hadith #5

5ـ عَلِيُّ بْنُ إِبْرَاهِيمَ عَنْ أَبِيهِ عَنْ عَلِيِّ بْنِ مَعْبَدٍ عَنْ هِشَامِ بْنِ الْحَكَمِ قَالَ سَأَلْتُ أَبَا عَبْدِ الله (عَلَيْهِ السَّلام) بِمِنًى عَنْ خَمْسِمِائَةِ حَرْفٍ مِنَ الْكَلامِ فَأَقْبَلْتُ أَقُولُ يَقُولُونَ كَذَا وَكَذَا قَالَ فَيَقُولُ قُلْ كَذَا وَكَذَا قُلْتُ جُعِلْتُ فِدَاكَ هَذَا الْحَلالُ وَهَذَا الْحَرَامُ أَعْلَمُ أَنَّكَ صَاحِبُهُ وَأَنَّكَ أَعْلَمُ النَّاسِ بِهِ وَهَذَا هُوَ الْكَلامُ فَقَالَ لِي وَيْكَ يَا هِشَامُ لا يَحْتَجُّ الله تَبَارَكَ وَتَعَالَى عَلَى خَلْقِهِ بِحُجَّةٍ لا يَكُونُ عِنْدَهُ كُلُّ مَا يَحْتَاجُونَ إِلَيْهِ.

5. Ali ibn Ibrahim has narrated from his father from Ali ibn Ma‘bad from Hisham ibn al-Hakam who has said the following. “I asked abu ‘Abdallah (a.s.) at Mina five hundred letters from al-Kalam (theology). I asked the Imam (a.s.), “They say that he has said so and so.” Then he says, “You say so and so.” I then said to the Imam (a.s.), “May Allah, take my soul in service for your cause, “This is lawful and that is not lawful. I know that you are the authority in this and you are the most knowledgeable person in it and this is al-Kalam.” The Imam (a.s.) said to me, “O poor, Hisham, Allah, the Most Holy, the Most High, does not require any duty from His creatures without first availing them all that they need to comply with the command.”