Ensure consistent return type of input functions
Ensure consistent return type of input functions

The rangeEnclosingPositionWithGranularityInDirection function would in
some cases (incorrectly) return a single number, and in other cases
return a pair of numbers (specifying the start and end of the range).
This resulted in the TypeScript compiler giving a "No best common type
exists among return expressions" error as soon as addPosition() was
given a specific return type.

The cases where the the function was returning a single number were
actually error/invalid state conditions, so these have now been changed
to return null, to match the behaviour of the function on other similar
conditions.

corinthia/corinthia-editorlib,corinthia/corinthia-editorlib,corinthia/corinthia-editorlib,corinthia/corinthia-editorlib,corinthia/corinthia-editorlib,corinthia/corinthia-editor,corinthia/corinthia-editor,corinthia/corinthia-editor,corinthia/corinthia-editor,corinthia/corinthia-editor