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

[breaking] type-safe Maybe.all implementation #88

Merged
merged 6 commits into from
Dec 17, 2020
Merged

Conversation

chriskrycho
Copy link
Collaborator

  • [breaking] Reimplement Maybe.all using variadic tuple types.
  • Deprecate Maybe.tuple as extraneous now that Maybe.all can handle both tuples and arrays.
  • Update dev version of TS to 4.1.3
  • [breaking] In preparation for implementing Type-safe Maybe.tuple and Maybe.all #87, remove support for versions prior to TypeScript 4.0, which introduced the variadic tuples type feature required to implement Maybe.all and Maybe.tuple safely.

Resolves #87

In preparation for implementing #87, remove support for versions prior
to TypeScript 4.0, which introduced the variadic tuples type feature
required to implement `Maybe.all` and `Maybe.tuple` safely.
- Reimplement `Maybe.all` using variadic tuple types.
- Deprecate `Maybe.tuple` as extraneous now that `Maybe.all` can handle
  both tuples and arrays.

Resolves #87
I incorrectly assumed that we would need to explicitly trigger the tuple
semantics with `[...U]`, but those semantics are now baked deeply into
the compiler's understanding of array types, so we can eliminate the
conditional and inferred type in favor of a mapped type, which
redistributes the type appropriately over an array or tuple.
CHANGELOG.md Show resolved Hide resolved
src/maybe.ts Outdated Show resolved Hide resolved
@chriskrycho chriskrycho merged commit 8048e30 into main Dec 17, 2020
@chriskrycho chriskrycho deleted the type-safe-tuple branch December 17, 2020 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type-safe Maybe.tuple and Maybe.all
2 participants