Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(network): adjust Listener type params #18642

Merged
merged 6 commits into from
Aug 27, 2023
Merged

Conversation

jodinathan
Copy link
Contributor

fixes #18635

@CLAassistant
Copy link

CLAassistant commented Apr 8, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

I'm marking this as "Request changes" because this PR changes types of the public stable Deno APIs that might have big impact on users. We need to carefully check if this will cause any breakages and if so we should line this change for Deno 2.0 release.

@jodinathan
Copy link
Contributor Author

@bartlomieju thanks.
We need this change so deno can run on some specific environments and TlsListener extending both Listener and AsyncIterable is seen as an error =\

@jodinathan
Copy link
Contributor Author

were you able to check this?
it doesn't seem to be a breakable change

@bartlomieju
Copy link
Member

Hey @jodinathan, sorry for a slow response. I haven't had a chance to verify it, I'll try to get someone to check it before the next minor release.

Copy link
Collaborator

@nayeemrmn nayeemrmn left a comment

Choose a reason for hiding this comment

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

LGTM

Here's how I checked for breaking changes:

export interface Listener2<T extends Deno.Conn = Deno.Conn> extends AsyncIterable<T> {
  accept(): Promise<T>;
  close(): void;
  readonly addr: Deno.Addr;
  readonly rid: number;
  [Symbol.asyncIterator](): AsyncIterableIterator<T>;
  ref(): void;
  unref(): void;
}

export type TlsListener2 = Listener2<Deno.TlsConn>;

let a: Deno.Listener = eval("{}");
let b: Listener2 = eval("{}");
a = b;
b = a;
let c: Deno.TlsListener = eval("{}");
let d: TlsListener2 = eval("{}");
c = d;
d = c;

// No type checking errors on the assignments. Types are equivalent.

@bartlomieju bartlomieju added this to the 1.37 milestone Aug 18, 2023
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jodinathan

@bartlomieju bartlomieju merged commit d22a666 into denoland:main Aug 27, 2023
bartlomieju pushed a commit that referenced this pull request Aug 31, 2023
@jodinathan
Copy link
Contributor Author

was this published?

@bartlomieju
Copy link
Member

Yes, this was published in Deno v1.37

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.

Add a type param to Listener interface
4 participants