Avoiding 'NoSuchElementException' in a TypeScript code snippet - Effect Community