Skip to content

Commit

Permalink
chore: remove unnecessary casting
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Mar 11, 2024
1 parent 4597384 commit 0630e45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/getCustomHelia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export async function getCustomHelia (): Promise<Helia> {

let blockstore: HeliaInit['blockstore'] | undefined
if (FILE_BLOCKSTORE_PATH != null) {
blockstore = new LevelBlockstore(FILE_BLOCKSTORE_PATH) as HeliaInit['blockstore']
blockstore = new LevelBlockstore(FILE_BLOCKSTORE_PATH)
}

let datastore: HeliaInit['datastore'] | undefined
if (FILE_DATASTORE_PATH != null) {
datastore = new LevelDatastore(FILE_DATASTORE_PATH) as HeliaInit['datastore']
datastore = new LevelDatastore(FILE_DATASTORE_PATH)
}

if (USE_LIBP2P || USE_BITSWAP) {
Expand All @@ -39,7 +39,7 @@ export async function getCustomHelia (): Promise<Helia> {
blockstore,
datastore,
blockBrokers
}) as unknown as Promise<Helia>
})
}

const routers: HeliaInit['routers'] = []
Expand All @@ -52,5 +52,5 @@ export async function getCustomHelia (): Promise<Helia> {
datastore,
blockBrokers,
routers
}) as unknown as Promise<Helia>
})
}
5 changes: 2 additions & 3 deletions src/heliaServer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
import { setMaxListeners } from 'node:events'
import { createVerifiedFetch } from '@helia/verified-fetch'
import { createVerifiedFetch, type VerifiedFetch } from '@helia/verified-fetch'
import { type FastifyReply, type FastifyRequest, type RouteGenericInterface } from 'fastify'
import { USE_SUBDOMAINS } from './constants.js'
import { contentTypeParser } from './content-type-parser.js'
Expand Down Expand Up @@ -43,7 +42,7 @@ interface HeliaFetchOptions extends HeliaPathParts {
}

export class HeliaServer {
private heliaFetch!: Awaited<ReturnType<typeof createVerifiedFetch>>
private heliaFetch!: VerifiedFetch
private heliaVersionInfo!: { Version: string, Commit: string }
private readonly HOST_PART_REGEX = /^(?<address>.+)\.(?<namespace>ip[fn]s)\..+$/
private readonly log: Logger
Expand Down

0 comments on commit 0630e45

Please sign in to comment.