Nintendo has already stated how long they will support the Nintendo Switch for.
President Shuntaro Furuwaka stated that we are "still working on software for the Switch for the fiscal year ending March 31, 2025"
March 31, 2025 will be the last day any Nintendo published games will be released on the Switch.
Nintendo Online Support, online multiplayer support, eShop support, and Hardware manufacturing are a different thing.
I think that the successor will have all of these but specifically declare the Switch support for these will be discontinued respectively in April 1, 2030; April 1 2030; April 1, 2029 & April 1, 2027.
3DS eShop closed 12 years after its release and online services close 13 years after its release.
Furuwaka stated that the Switch was at its halfway point in its lifecycle by its 5th year, which is 10 years of shelf life.
Lifetime Sales Predictions
Switch: 160 million (was 120 million, then 140 million, then 150 million)
PS5: 130 million (was 124 million)
Xbox Series X/S: 54 million (was 60 million, then 57 million)
"The way to accomplish great things, is to be indefatigable and never rest till the thing is accomplished." - Joseph Smith Jr.