The Imams (a.s.) do have the knowledge of what was and will be, and that nothing is unknown to them (a.s.)

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