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 support for Iterable, require Node.js 8, add TypeScript definition #6

Merged
merged 3 commits into from
Apr 5, 2019
Merged

Add support for Iterable, require Node.js 8, add TypeScript definition #6

merged 3 commits into from
Apr 5, 2019

Conversation

BendingBender
Copy link
Contributor

No description provided.

```
*/
declare function arrify(value: null | undefined): [];
declare function arrify(value: string): [string];
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think you should special-case string. It's a separate check in the code as string is also iterable, so otherwise it would be used as an iterable instead of a string.

How about this instead?

Suggested change
declare function arrify(value: string): [string];
declare function arrify<ValueType(value: ValueType): [ValueType];

Can you also add a (type and normal) test for arrify(1) and arrify(true)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right about the catch-all case, missed this one. string is however iterable, so we still have to special-case it.

@sindresorhus sindresorhus merged commit 8d6734f into sindresorhus:master Apr 5, 2019
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.

None yet

2 participants