For some reason it appears that in the StringLineIterator class the #next function is called one-too-many times which results in the required type-check found here.
When used with a for ... of ([Symbol.iterator]) construct, there is always one final call to #next that does not return content to the iterator but that results in undefined being returned which was causing the call to String#trim() to throw a runtime error.
For some reason it appears that in the
StringLineIteratorclass the#nextfunction is called one-too-many times which results in the required type-check found here.When used with a
for ... of([Symbol.iterator]) construct, there is always one final call to#nextthat does not return content to the iterator but that results inundefinedbeing returned which was causing the call toString#trim()to throw a runtime error.