Typed static queries

I'm opening this PR so we can discuss the current state of the implementation.
Oh, I see, we can't configure this through testkit.