The necessity of baptism is so great that if anyone were to die without reception of Baptism, or at least desire for it, he could by no means enter heaven. Because infants are liable to danger of this sort, and can easily die, but still do not have capacities to desire Baptism, therefore it is necessary to baptize them as soon as possible. And although they do not understand that which they receive, nevertheless, the Church supplies that which it responds and pledges for them by means of the godparents, which suffices. Just as by Adam we have all fallen into sin and disfavor with God when we still did not know it, so also it is enough for God if, through Baptism and the Church, we are freed from sin and received in its grace even if we do not yet notice.
[St. Robert Bellarmine, Doctrina Christiana: The Timeless Catechism of St. Robert Bellarmine, Grant, tr., Mediatrix Press (2016) pp. 159-160.]
Bellarmine's language, "Baptism, or at least desire for it," follows that of the Council of Trent (Session 6, Chapter 4) about translation to the state of grace: "this translation, since the promulgation of the Gospel, cannot be effected, without the laver of regeneration, or the desire thereof, as it is written; unless a man be born again of water and the Holy Ghost, he cannot enter into the Kingdom of God".