parseAsTuple
- Lingua principale
- TypeScript
- Stelle
- 10.8k
- Fork
- 294
- Merge medio
- 1g 16h
- PR unite (30g)
- 21
Descrizione
### Discussed in https://github.com/47ng/nuqs/discussions/1019
Please see the discussion there for guidance if you want to pick this issue for a PR. 🙏
Originally posted by **tacomanator** June 20, 2025
There have been a few situations where this would be useful, so I wanted to suggest it.
For example, a date range parser could be implemented as:
```ts
parseAsTuple([parseAsIsoDate, parseAsIsoDate])
```
Advantages over `parseAsArrayOf(parseAsDate)`:
1. Ensures both dates are present.
2. Resulting type of `[string, string]` instead of `string[]` prevents certain type errors.
3. Elements could have different types (not relevant in this example).
Just an example there are obviously many others.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.