mirror of
https://github.com/sern-handler/handler
synced 2026-06-27 18:22:14 +00:00
work on strategy and lifted Context
This commit is contained in:
18
src/core/structures/context.ts
Normal file
18
src/core/structures/context.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Result as Either } from 'ts-results-es';
|
||||
|
||||
|
||||
export abstract class Context<Left, Right> {
|
||||
private constructor(private _: Either<Left, Right>){}
|
||||
|
||||
abstract get message(): Left;
|
||||
abstract get interaction(): Right;
|
||||
abstract get id(): string;
|
||||
|
||||
}
|
||||
|
||||
export function wrap<Left, Right>(
|
||||
val: Left|Right,
|
||||
fa: (val: Left|Right
|
||||
) => Either<Left, Right>) {
|
||||
return fa(val);
|
||||
}
|
||||
Reference in New Issue
Block a user