The gemara (berachos 5a) writes:
(translation based on sefaria)
וא"ר לוי בר חמא אמר ר' שמעון בן לקיש מאי דכתיב ואתנה לך את לוחות האבן והתורה והמצוה אשר כתבתי להורותם לוחות אלו עשרת הדברות תורה זה מקרא והמצוה זו משנה אשר כתבתי אלו נביאים וכתובים להורותם זה גמרא מלמד שכולם נתנו למשה מסיני
And R' Levy the son of Chama said in the name of R' Shimon the son of Lakish: What’s the meaning of the verse (Exodus 24:12) "And I will give you the stone tablets with the teachings and commandments which I have inscribed to instruct them"? The “tablets” are the ten commandments, the “Torah” is the five books of Moses, the “mitzva” is the Mishna, “That I have written” refers to the Prophets and Writings, “That you may teach them” refers to the Talmud. This teaches that all aspects of Torah were given to Moses from Sinai.
This seems to indicate that the entire tanach (and more) were already given to Moshe at Sinai.
However, later in the gemara (Bava Basra 14b et seq.), there is a discussion as to who wrote each book of Tanach, indicating that Moshe did not receive them all.
Is there any way to reconcile these two gemaras?