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

New types added in 6.13.4 exclude possibility of null in arrays #280

Closed
pbeshai opened this issue Oct 1, 2020 · 3 comments · Fixed by #281
Closed

New types added in 6.13.4 exclude possibility of null in arrays #280

pbeshai opened this issue Oct 1, 2020 · 3 comments · Fixed by #281

Comments

@pbeshai
Copy link

pbeshai commented Oct 1, 2020

The new types added in #279 are too restrictive as they eliminate the possibility of nulls being in the arrays.

Consider the following acceptable use of parse and stringify:

> const qs = require('query-string')
undefined

> qs.parse('?foo&foo=1&foo&foo=test&foo=&foo')
[Object: null prototype] { foo: [ null, '1', null, 'test', '', null ] }

> qs.stringify({ foo: [null, '1', null, 'test', '', null] })
'foo&foo=1&foo&foo=test&foo=&foo'

While [null, '1', null, 'test', '', null] is a valid value, it does not meet the definition of Stringifiable[] which is (string | boolean | number)[]

@sindresorhus
Copy link
Owner

That looks like a mistake.

// @esetnik

@esetnik
Copy link
Contributor

esetnik commented Oct 2, 2020

Sorry about that. Let me know if #281 solves this issue.

@pbeshai
Copy link
Author

pbeshai commented Oct 2, 2020

Thanks! That does the trick 👍

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 a pull request may close this issue.

3 participants