refactor: ♻️ fix types and update import to import type

This commit is contained in:
Julien Oculi 2024-06-18 10:29:21 +02:00
parent 2028c0134a
commit aefdacbf59

View file

@ -1,4 +1,4 @@
import { Db } from '@/mod.ts'
import type { Db } from '@/mod.ts'
import type { UUID } from '@/types.ts'
import {
Credential,
@ -38,8 +38,9 @@ export class Ref<T extends Ressource> extends String {
}
static dbResolver(db: Db) {
return <T extends Ressource>(ref: RefString<T>) => {
return <T extends Ressource>(ref: RefString<T>): Promise<T> => {
const { type, uuid } = Ref.parse(ref)
//@ts-expect-error force type casting to fix
return db.ressource[type].get({ uuid })
}
}