A newly-published patent shows that the Switch 2 controllers will indeed have optical sensors that allow the JoyCons to be used as mice.

The Switch 2's new and improved JoyCons will have some interesting surprises this time. Gamers will be able to use the devices as makeshift mice, presumably a unique new form of gimmicky interaction for games like Mario Party and perhaps even a new generation Mario Paint.
The functionality was first outed in the highly accurate Switch 2 leaks, and then hinted at by Nintendo in the Switch 2's original reveal video. Now we have even more proof that the JoyCons can be used as mice--this time lifted directly from a patent for the actual accessory hardware.
According to the patent, which shows some of the things that the Switch 2's JoyCons can (and not necessarily will) do, the devices can have an optical sensor for tracking
"The input device of the above may further include a hole provided on one side surface for directing reflected light to a mouse operation sensor, and a set of four buttons provided on the front surface," the patent reads when describing Figure 24.]
The patent also shows a very curious-looking gamepad that could be the Switch 2's Pro controller, or some approximation of the device. Nintendo has yet to reveal whether or not the Switch 2 will have a pro controller variant.

Nintendo will announce more information about the Switch 2 during a special Nintendo Direct stream on April 2, 2025, just two days after the company starts its Fiscal Year 2026 period.
The Switch 2 will be released sometime in 2025.