Skip to content

Commit

Permalink
fix(lib): use and export Objection model unwrapper for typings
Browse files Browse the repository at this point in the history
#Patch release
  • Loading branch information
Harjot1Singh authored Oct 15, 2022
1 parent e12e61f commit 890cf16
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
/* eslint-disable max-classes-per-file, import/no-extraneous-dependencies */

declare module '@shabados/database' {
import { Model, QueryBuilder } from 'objection'
import { Model, ModelObject, QueryBuilder } from 'objection'

type RecursiveHelper<T> = { [P in keyof T]: UnwrapModel<T[P]> }

export type UnwrapModel<M> = M extends Model
? RecursiveHelper<ReturnType<M['toJSON']>>
: RecursiveHelper<M>
export type { Model, ModelObject, QueryBuilder }

export const knex: ReturnType<Model['$knex']>

Expand Down

0 comments on commit 890cf16

Please sign in to comment.