Skip to content

Conversation

@petebacondarwin
Copy link
Contributor

Summary

  • Change the readline Interface class and the readline/promises Interface and Readline classes to be no-op stubs instead of throwing errors
  • Methods now return sensible defaults (empty strings, zero values, etc.) instead of throwing ERR_METHOD_NOT_IMPLEMENTED errors
  • This matches the behavior of unenv's readline implementation, which allows code that depends on readline to work without crashing even though the functionality is not fully implemented

Fixes compatibility with cloudflare/workers-sdk#11734

Change the readline Interface class and the readline/promises Interface
and Readline classes to be no-op stubs instead of throwing errors.

This matches the behavior of unenv's readline implementation, which allows
code that depends on readline to work without crashing even though the
functionality is not fully implemented.

Methods now return sensible defaults (empty strings, zero values, etc.)
instead of throwing ERR_METHOD_NOT_IMPLEMENTED errors.

Fixes compatibility with cloudflare/workers-sdk#11734
@petebacondarwin petebacondarwin requested review from a team as code owners February 4, 2026 20:01
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

throw new ERR_METHOD_NOT_IMPLEMENTED('Interface.question');
// If callback is the second argument (no options)
if (typeof _options === 'function') {
(_options as (answer: string) => void)('');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove unknown type in function declaration and use the union of two types to avoid this?

[Symbol.asyncIterator](): NodeJS.AsyncIterator<string, undefined, any> {
throw new ERR_METHOD_NOT_IMPLEMENTED('Interface[Symbol.asyncIterator]');
async *[Symbol.asyncIterator](): NodeJS.AsyncIterator<string> {
yield '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment to why we are returning this?

[Symbol.asyncIterator](): NodeJS.AsyncIterator<string, undefined, any> {
throw new ERR_METHOD_NOT_IMPLEMENTED('Interface[Symbol.asyncIterator]');
async *[Symbol.asyncIterator](): NodeJS.AsyncIterator<string> {
yield '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a small comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants