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

feat(almin): Support `context.useCase#execute` typing #342

Merged
merged 12 commits into from Apr 27, 2018

Conversation

@azu
Copy link
Member

commented Mar 28, 2018

Imporve useCase#execute typing by conditional type

Refs #107

azu added 4 commits Mar 28, 2018
BREAKING CHANGE: You can not call `super({ type: "type" })` anymore.
`Payload` does not accept arguments
Use conditional typing
@@ -139,11 +146,14 @@ export interface UseCaseExecutor<T extends UseCaseLike> extends Dispatcher {

executor(executor: (useCase: Pick<T, "execute">) => any): Promise<void>;

execute(): Promise<void>;
// FIXME: should fix `execute()` pattern
execute<P extends A0<T["execute"]>>(): P extends never ? never : Promise<void>;

This comment has been minimized.

Copy link
@azu

azu Mar 28, 2018

Author Member

I don't know how to realize no-argument type...

// typings:expect-error
context
.useCase(new MyUseCase())
.execute()

This comment has been minimized.

Copy link
@azu

azu Mar 28, 2018

Author Member

I want to make context.useCase(new MyUseCase()).execute() error.

@azu azu force-pushed the typescript-2.8 branch from 7525190 to d3c11a8 Apr 27, 2018
azu added 3 commits Apr 27, 2018
@azu azu merged commit 735f030 into master Apr 27, 2018
3 checks passed
3 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
@azu azu deleted the typescript-2.8 branch Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.