I know a workaround exists by using forceWeaponFire as explained on its wiki page, but a more official method would be neat.
The workaround way also doesn't allow you to switch firemode until the weapon is ready to fire. Meaning if you're switching from your secondary to primary weapon, you have to wait for a few seconds before the workaround can be used.