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

Deprecate executor() #356

Open
3 of 4 tasks
azu opened this issue Aug 25, 2018 · 0 comments
Open
3 of 4 tasks

Deprecate executor() #356

azu opened this issue Aug 25, 2018 · 0 comments

Comments

@azu
Copy link
Member

azu commented Aug 25, 2018

UseCaseExecutor#executor has been introduced as a workaround of " TypeScript: improve UseCase#execute typing #107 ".

In Almin 0.18+, UseCaseExecutor#execute type will be complete in #355

📝 Require TypeScript 3.0+

The user should use UseCaseExecutor#execute instead of UseCaseExecutor#executor.

Changes

Before: executor()

import { UseCase, Context } from "almin";
class MyUseCaseA extends UseCase {
    execute(_a: string) {}
}
const context = new Context({
    store: createStore({ name: "test" })
});

// executor
context.useCase(new MyUseCaseA()).executor(useCase => useCase.execute("A")); 

After: execute()

import { UseCase, Context } from "almin";
class MyUseCaseA extends UseCase {
    execute(_a: string) {}
}
const context = new Context({
    store: createStore({ name: "test" })
});

//execute
context.useCase(new MyUseCaseA()).execute("A");

Migration

almin/migration-tools support this changes.

Apply 0.17.x → 0.18.x migration or --script "executor-to-execute"

# TypeScript
$ almin-migration-tools "src/**/*.{ts,tsx}" --script "executor-to-execute"
# JavaScript
$ almin-migration-tools "src/**/*.{js}" --script "executor-to-execute"

Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant