In typst official documentation of statehere for the .final() method, it says: “This argument is deprecated. It only exists for compatibility with Typst 0.10 and lower and shouldn’t be used anymore.”
So how can I visit the final state if I don’t use state.final() method?
In new typst, the correct way to perform contextual queries is using context, such as context state.final(). This is equivalent to context state.final(here()), replacing locate(loc => state.final(loc)).
Each context expression has a unique here() location in the document and the location will be passed to contextual query functions implicitly, so you don’t have to pass them as arguments explicitly.
To add to that: In the case of final(), it didn’t even make use of the location (in contrast to get) since it is not dependent on where it is called. It just needed to ensure that it’s only usable within a locate.