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

Use type variables in TypeScript typings instead of never #230

Merged
merged 3 commits into from
May 10, 2018

Conversation

tetsuo
Copy link
Contributor

@tetsuo tetsuo commented Mar 5, 2018

F.of(x => y => [x, y])
  .ap(future1)
  .ap(future2)

TSC throws a compilation error in here, since of always assumes that it doesn't throw a rejection.

Adding a new type variable instead using never should fix the issue, but it might break other things where the error type is not specified explicitly.

@Avaq I added it to of and after. Anything else that needs to be fixed?

@codecov-io
Copy link

codecov-io commented Mar 5, 2018

Codecov Report

Merging #230 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #230   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          48     48           
  Lines        1187   1187           
=====================================
  Hits         1187   1187

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c419778...613291d. Read the comment docs.

@Avaq
Copy link
Member

Avaq commented Mar 5, 2018

I believe this approach is the better one in all instances where never us used.

@Avaq
Copy link
Member

Avaq commented Mar 20, 2018

Would you like to make the proposed adjustment to all the other never using functions (except value), @tetsuo? Or shall I make these changes and append them to your PR?

@tetsuo
Copy link
Contributor Author

tetsuo commented May 8, 2018

The final build requires @types/node typings for some reason, which is installed for Node.js v10 by default. This was causing builds to fail during declaration file testing. It looks like the default node typings require Map, Set and so on. I included ES6 typings too. We can also try installing one of the earlier versions of @types/node. Also updated TypeScript to 2.8.x just for kicks.

Should we consider adding a package-lock.json file by the way?

@Avaq
Copy link
Member

Avaq commented May 10, 2018

This looks great! Thank you.

I remain of the opinion that package locks are only relevant in "root" level packages, eg applications. It's a feature to accommodate safer deployments. When installing a package as a dependency, I believe its package lock is ignored. Instead, I use greenkeeper to react to broken dependencies.

@Avaq Avaq merged commit d8513cd into fluture-js:master May 10, 2018
Avaq added a commit that referenced this pull request Jul 26, 2018
Breaking changes

- #224 Exceptions are now caught and rethrown in `fork`.
- #230 Many of the TypeScript type definitions that used `never` now use a
  generic instead.
- #238 When unsubscribing from a Future created by `hook`, the cancellation
  signal is no longer sent to the disposal Future.
- #266 Exported TypeScript interfaces have been renamed to avoid naming
  conflicts with exported values.

New features

- #250 Included interoperability with Sanctuary Show
- #261 Added a new function, `forkCatch`, which allows for exception recovery.
@Avaq Avaq mentioned this pull request Sep 19, 2019
Avaq added a commit that referenced this pull request Sep 25, 2019
- Revert #230 and reintroduce the usage of the 'never' type
- Relax the signature of chain and chainRej to allow TypeScript to
  derive types when merging a Future of a never with a Future of a
  real type. Closes #337 and closes #370.
- Move generic types closer to where they are used in the function
  signature. Closes #372 and closes #373 through supersession.

Co-authored-by: Edgar Rodriguez <edgarj.rodriguezg@gmail.com>
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

3 participants