Skip to content

Commit

Permalink
fix: add optional type for file candidate data
Browse files Browse the repository at this point in the history
Where we know the type of content to be imported ahead of time
(e.g. a Uint8Array or a stream, not both), it can be helpful to
specify that type, so make `FileCandidate` generic to allow this.

Defaults it to the previous `ImportContent` value so this is
non-breaking.
  • Loading branch information
achingbrain committed Jun 30, 2023
1 parent e3a1cb1 commit c718213
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/ipfs-unixfs-importer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export type ImportContent = ByteStream | Uint8Array

export type WritableStorage = Pick<Blockstore, 'put'>

export interface FileCandidate {
export interface FileCandidate<T extends ImportContent = ImportContent> {
path?: string
content: ImportContent
content: T
mtime?: Mtime
mode?: number
}
Expand Down

0 comments on commit c718213

Please sign in to comment.