Skip to content

Commit

Permalink
Revert "feat: BlockCodec methods are generic"
Browse files Browse the repository at this point in the history
This reverts commit 2ee062e.
  • Loading branch information
rvagg committed Jul 24, 2024
1 parent d95510e commit e46e7fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/codecs/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import type { ArrayBufferView, ByteView } from '../block/interface.js'
/**
* IPLD encoder part of the codec.
*/
export interface BlockEncoder<Code extends number, Universe> {
export interface BlockEncoder<Code extends number, T> {
name: string
code: Code
encode<T extends Universe>(data: T): ByteView<T>
encode(data: T): ByteView<T>
}

/**
* IPLD decoder part of the codec.
*/
export interface BlockDecoder<Code extends number, Universe> {
export interface BlockDecoder<Code extends number, T> {
code: Code
decode<T extends Universe>(bytes: ByteView<T> | ArrayBufferView<T>): T
decode(bytes: ByteView<T> | ArrayBufferView<T>): T
}

/**
* An IPLD codec is a combination of both encoder and decoder.
*/
export interface BlockCodec<Code extends number, Universe> extends BlockEncoder<Code, Universe>, BlockDecoder<Code, Universe> {}
export interface BlockCodec<Code extends number, T> extends BlockEncoder<Code, T>, BlockDecoder<Code, T> {}

export type { ArrayBufferView, ByteView }

0 comments on commit e46e7fe

Please sign in to comment.