https://github.com/nikelborm/ts-better-tuple
typesafe iteration over tuples and more
https://github.com/nikelborm/ts-better-tuple
Last synced: 4 months ago
JSON representation
typesafe iteration over tuples and more
- Host: GitHub
- URL: https://github.com/nikelborm/ts-better-tuple
- Owner: nikelborm
- Created: 2024-10-25T05:12:30.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-04T20:59:43.000Z (4 months ago)
- Last Synced: 2025-02-04T21:40:34.278Z (4 months ago)
- Language: TypeScript
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ts-better-tuple
Typesafe iteration over tuples and more
Helpers:
1. [ksxnodemodules/typescript-tuple](https://github.com/ksxnodemodules/typescript-tuple)
2. [totalolage/typescript-tuple](https://github.com/totalolage/typescript-tuple)
3. [graffhyrum/entries.md](https://gist.github.com/graffhyrum/1253b24fbe80d5f508544736d83d9532)
4. https://github.com/microsoft/TypeScript/pull/24897#issuecomment-419406826
5. https://github.com/gvergnaud/hotscriptProblem to be solved:
1. Mapping (`[...].map((e, i, a) => ...)`) tuples breaks types and doesn't allow for cool type inference
2. fucked up `Object.keys()`, `Object.values()`, `Object.entries()`, `Object.fromEntries()`, `Array.prototype.map()`, `Array.prototype.reduce()`, `Array.prototype.filter()` which lose a tonn of type information partly for example because `.map` accepting split parameters breaks the relation between them. Also index is `number` which we know can be `0|1|2|3|4...`.