model.ContentMatch.edge can return nullable fields

Hi,

I’ve noticed than unlike what’s stated in the docs, model.ContentMatch.edge can return nullable fields. Indeed, it we look at the sources, it should throw a RangeError if i >= this.next.length instead of i > this.next.length like it is right now, if we consider n starts at 0 (maybe this should be clarified too).

I can create an Issue and/or a PR if needed.

Thanks for all the huge work you’ve done

Thanks for pointing that out. I’ve fixed it, since I also noticed an issue in the doc comment just now, and wanted to fix that as well.

Thanks for the very quick fix! I discovered the zero-width space character thanks to that, I also saw the bug in the docs but had no idea how to fix it. It could probably throw a RangeError if i < 0 too but I guess I’m too influenced by my static typing background ^^

Throwing a RangeError in resolveDepth of ResolvedPos when depth < -this.depth || depth >= this.depth would also ensure that node and index functions don’t return null values and that indexAfter, start, end, before, after functions don’t return potentially incoherent numbers.