PeerTube/server/types/sequelize.ts

20 lines
710 B
TypeScript
Raw Normal View History

2021-05-12 07:09:04 -05:00
import { AttributesOnly } from '@shared/core-utils'
import { Model } from 'sequelize'
2019-04-23 02:50:57 -05:00
// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript
export type Diff<T extends string | symbol | number, U extends string | symbol | number> =
({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T]
export type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] }
export type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> }
2021-05-12 07:09:04 -05:00
export type FilteredModelAttributes<T extends Model<any>> = Partial<AttributesOnly<T>> & {
2019-04-23 02:50:57 -05:00
id?: number | any
createdAt?: Date | any
updatedAt?: Date | any
deletedAt?: Date | any
version?: number | any
}