File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments