The 21-year-old singer admitted as much of the One Direction heartthrob in an interview with Teen Vogue. Trainor and Styles collaborated on new duet "Someday Maybe" and recorded a rough demo of the track.
"Performing a love song in front of Harry is terrifying, and on top of that I was a little nervous because he was one of the first celebrities I met," Trainor recalled. "[The song is] a cute little number ... it needs a good home."
"Harry was super talented at writing, and his lyrics were incredible -- probably my favorite lyrics in a song," she lauded. "I remember I wrote it at midnight the night before and sent it to my mom I was so worried he was going to hate it."
Trainor is known for such hits as "All About That Bass" and "Dear Future Husband," which both appear on her 2014 EP, Title. The singer released a studio album of the same in January, which includes duet "Like I'm Gonna Lose You" with John Legend.