The galaxy–halo connection of emission-line galaxies in IllustrisTNG