# Using WhenEvent with DSolve (not NDSolve)

The documentation says

WhenEvent expressions can be used in NDSolve, NDSolveValue, ParametricNDSolve, ParametricNDSolveValue, DSolve, and DSolveValue.

But when I try this toy case

DSolve[{f[0]==0,f'[t]==2,WhenEvent[f[t]==5,f[t]->10]},f,t]


It complains that

Equation or list of equations expected instead of WhenEvent[f[t]==5,f[t]->10] in the first argument {f[0]==0,f'[t]==2,WhenEvent[f[t]==5,f[t]->10]}

But when I use this same eqn in NDSolve it works fine. So how do I get WhenEvent working with DSolve?

From the documentation of DSolve, this is classified as a hybrid-differential equation.
You need to specify the range of t something like {0, 10}
DSolve[{f[0] == 0, f'[t] == 2, WhenEvent[f[t] == 5, f[t] -> 10]}, f[t], {t, 0, 10}]