refactor: ♻️ fix types and update import to import type
This commit is contained in:
parent
2028c0134a
commit
aefdacbf59
|
@ -1,4 +1,4 @@
|
||||||
import { Db } from '@/mod.ts'
|
import type { Db } from '@/mod.ts'
|
||||||
import type { UUID } from '@/types.ts'
|
import type { UUID } from '@/types.ts'
|
||||||
import {
|
import {
|
||||||
Credential,
|
Credential,
|
||||||
|
@ -38,8 +38,9 @@ export class Ref<T extends Ressource> extends String {
|
||||||
}
|
}
|
||||||
|
|
||||||
static dbResolver(db: Db) {
|
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)
|
const { type, uuid } = Ref.parse(ref)
|
||||||
|
//@ts-expect-error force type casting to fix
|
||||||
return db.ressource[type].get({ uuid })
|
return db.ressource[type].get({ uuid })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue