Skip to content

Deprecate executor() #356

Open
Open
@azu

Description

@azu

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions