Skip to content

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

Merged
azu merged 12 commits intomasterfrom
typescript-2.8
Apr 27, 2018
Merged

feat(almin): Support context.useCase#execute typing #342
azu merged 12 commits intomasterfrom
typescript-2.8

Conversation

@azu
Copy link
Copy Markdown
Member

@azu azu commented Mar 28, 2018

Imporve useCase#execute typing by conditional type

Refs #107

azu added 4 commits March 28, 2018 09:29

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

Choose a reason for hiding this comment

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

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

// typings:expect-error
context
.useCase(new MyUseCase())
.execute()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

@azu azu force-pushed the typescript-2.8 branch from 7525190 to d3c11a8 Compare April 27, 2018 01:59
@azu azu merged commit 735f030 into master Apr 27, 2018
@azu azu deleted the typescript-2.8 branch April 27, 2018 14:56
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.

1 participant