separate types

This commit is contained in:
Oli Sturm
2026-04-24 18:15:22 +01:00
parent b1ac745d70
commit d0c9466170
13 changed files with 178 additions and 221 deletions
+31
View File
@@ -0,0 +1,31 @@
import { Result } from '../library/result.js';
import { Account, AccountError } from '../domain/account.js';
export type Repository = {
loadAccount: (id: string) => Result<Account, AccountError>;
saveAccount: (account: Account) => Result<Account, AccountError>;
};
export type AppErrorRepositoryCreationFailed = {
type: 'RepositoryCreationFailed';
message: string;
};
export type AppErrorInnerAccountError = {
type: 'InnerAccountError';
innerError: AccountError;
};
export type AppError =
| AppErrorRepositoryCreationFailed
| AppErrorInnerAccountError;
export declare const repositoryCreationFailed: (
message: string
) => AppErrorRepositoryCreationFailed;
export declare const innerAccountError: (
innerError: AccountError
) => AppErrorInnerAccountError;
export declare const createInMemoryRepository: () => Repository;