How to select content between two resolved positions

I’m trying to write a utils interface over tiptap/ prosemirror. What I want to do is create a helper method that selects everthing between two positions (from, to).

selectPosition(from: ResolvePosition, to: ResolvePosition) {
 // ... implementation

I’ve tried looking in the reference manual but have not found anything that might help. I have tried TextSelection.create but I’m not sure if it will cover all cases for even absurd values of from and to or if it will actually select everything in between.

Sounds like you are looking for TextSelection.between.