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

Add TypeScript typings #6

Merged
merged 10 commits into from
Jan 10, 2025
Merged

Add TypeScript typings #6

merged 10 commits into from
Jan 10, 2025

Conversation

yassernasc
Copy link
Contributor

@yassernasc yassernasc commented Jan 9, 2025

The this overhead at lines at: _read(this: this, size: number): void are a workaround to correct the 'this' value inside functions passed on constructor like:

const stream = new Readable({
  read(size) {
    t.is(this, stream) // in this case, 'this' was ReadableOptions 
  }
})

Copy link
Contributor

@kasperisager kasperisager left a comment

Choose a reason for hiding this comment

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

Looks like the only missing bit for the primary typings is the pipeline() function.

@yassernasc yassernasc marked this pull request as ready for review January 10, 2025 17:25
@yassernasc
Copy link
Contributor Author

Added a more case at Readable.from because of this check: https://github.com/mafintosh/streamx/blob/7f745b9badded0f000247f06e8315387808aa9b1/index.js#L786

@yassernasc
Copy link
Contributor Author

beautiful

@yassernasc yassernasc merged commit cda2aff into main Jan 10, 2025
3 checks passed
@yassernasc yassernasc deleted the typescript-typings branch January 10, 2025 18:01
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