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

Update Future utility types #274

Open
wants to merge 1 commit into
base: future
Choose a base branch
from

Conversation

c-0d3-r
Copy link

@c-0d3-r c-0d3-r commented Dec 24, 2024

  • tests and linter show no problems (npm t)
  • tests are added/updated for bug fixes and new features
  • code is properly formatted (npm run fix)
  • description of changes is added in CHANGELOG.md
  • update .d.ts typings

Addresses part of #266 issue by:

  • Updating the .d.ts file by adding typing for Future utility

Closes #266 (partial).

@c-0d3-r c-0d3-r changed the base branch from master to future December 24, 2024 12:58
Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


type Resolve<T = unknown> = (value: T) => void;
type Reject = (reason?: Error | unknown) => void;
type Executor<T = unknown> = (resolve: Resolve<T>, reject?: Reject) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type Executor<T = unknown> = (resolve: Resolve<T>, reject?: Reject) => void;
type Executor<T = unknown> = (resolve: Resolve<T>, reject?: Reject) => unknown;

constructor(executor: Executor<T>);
chain<U = T>(fn: (value: T) => Future<U>): Future<U>;
map<U = T>(fn: (value: T) => U): Future<U>;
fork(successed: Resolve<T>, failed?: Reject): void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think about returning value

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need more use cases (tests) to think about contract improvements

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.

Need tests, docs, and typings for Future
2 participants