Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow arrays of arrays in intoStream.object TypeScript type definition #15

Merged
merged 3 commits into from
Aug 4, 2020

Conversation

aheuermann
Copy link
Contributor

I'm streaming arrays arrays of objects. Which works in the underlying library but the types don't currently reflect this.

const arr = [{a:1}, {a:2}];
intoStream.object([arr, arr])

I used any, but let me know if you would like it to be more restrictive.

Thanks for all your great libraries!

@aheuermann aheuermann changed the title Allow for any type of iterable Allow for arrays of arrays in intorStream.object type definition Aug 2, 2020
@sindresorhus
Copy link
Owner

I would prefer the type to be stricter.

@aheuermann
Copy link
Contributor Author

Fixed. Updated for my use-case. If there is a better way you had in mind to define this, let me know. I'm still fairly new to Typescript. Thanks again!

@sindresorhus
Copy link
Owner

I would look in the Node.js type definitions what type they use there for the object stream.

@aheuermann
Copy link
Contributor Author

aheuermann commented Aug 2, 2020

Looks like the definitions are pretty loose. I think any might be the best option to support the full api. Thoughts?

@sindresorhus
Copy link
Owner

Use object then. Lowercase.

@sindresorhus sindresorhus changed the title Allow for arrays of arrays in intorStream.object type definition Allow arrays of arrays in intoStream.object TypeScript type definition Aug 4, 2020
@sindresorhus sindresorhus merged commit ef2b8dc into sindresorhus:master Aug 4, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants