Skip to content

Commit 4de47eb

Browse files
committed
refactor: fix build
1 parent dc4674f commit 4de47eb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/utils/src/lib/wal.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,9 @@ export type WalStats<T> = {
6969
lastRecovery: RecoverResult<T | InvalidEntry<string>> | null;
7070
};
7171

72-
export const createTolerantCodec = <I, O = string>(codec: {
73-
encode: (v: I) => O;
74-
decode: (d: O) => I;
75-
}): Codec<I | InvalidEntry<O>, O> => {
72+
export const createTolerantCodec = <I, O = string, D = I>(
73+
codec: Codec<I, O, D>,
74+
): Codec<I | InvalidEntry<O>, O, D | InvalidEntry<O>> => {
7675
const { encode, decode } = codec;
7776

7877
return {
@@ -160,7 +159,8 @@ export class WriteAheadLogFile<T extends WalRecord = WalRecord>
160159
* Create a new WAL file instance.
161160
* @param options - Configuration options
162161
*/
163-
constructor(options: { file: string; codec: Codec<T> }) {
162+
/** Codec may decode to a supertype of T (e.g. TraceEvent when T is a narrower event type). */
163+
constructor(options: { file: string; codec: Codec<T, string, any> }) {
164164
this.#file = options.file;
165165
const c = createTolerantCodec(options.codec);
166166
this.#decode = c.decode;

0 commit comments

Comments
 (0)