When Allah placed Islam in my heart, I came to the Prophet ﷺ and said, "Extend your right hand so that I may pledge allegiance to you."He extended his hand, but I withdrew mine.He asked, "What is the matter, Amr?"I replied, "I wish to make a condition."He asked, "What condition?"I said, "That I be forgiven."He said, "Do you not know that Islam wipes out whatever came before it?"… the hadith continues.
لما جعل الله الإسلام في قلبي، أتيت النبي ﷺ، فقلت: ابسط يمينك فلأبايعك، فبسط يمينه، قال: فقبضت يدى. قال: ما لك يا عمرو. قال: قلت: أردت أن أشترط. قال: تشترط بماذا. قلت: أن يغفر لى. قال: أما علمت أن الإسلام يهدم ما كان قبله… الحديث.
Muslim narrated it in the Book of Faith (121) via Haywa bin Shurayh, who said, Yazid bin Abu Habib told me, from Ibn Shumasah Mahri, who said, "We visited Amr bin As while he was in the throes of death... He turned his face toward us and spoke," then he mentioned it in a long hadith.