mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: mongoose
This commit is contained in:
22
api/src/index.d.ts
vendored
22
api/src/index.d.ts
vendored
@@ -8,14 +8,7 @@
|
||||
|
||||
import 'mongoose';
|
||||
import { SubscriberStub } from './chat/schemas/subscriber.schema';
|
||||
import {
|
||||
ObjectWithNestedKeys,
|
||||
RecursivePartial,
|
||||
WithoutGenericAny,
|
||||
} from './utils/types/filter.types';
|
||||
|
||||
type TOmitId<T> = Omit<T, 'id'>;
|
||||
type TReplaceId<T> = TOmitId<T> & { _id?: string };
|
||||
declare module 'express-session' {
|
||||
interface SessionUser {
|
||||
id?: string;
|
||||
@@ -49,21 +42,6 @@ declare module 'express-session' {
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'mongoose' {
|
||||
// Enforce the typing with an alternative type to FilterQuery compatible with mongoose: version 8.0.0
|
||||
type TFilterQuery<T, S = TReplaceId<T>> = (
|
||||
| RecursivePartial<{
|
||||
[P in keyof S]?:
|
||||
| (S[P] extends string ? S[P] | RegExp : S[P])
|
||||
| QuerySelector<S[P]>;
|
||||
}>
|
||||
| Partial<ObjectWithNestedKeys<S>>
|
||||
) &
|
||||
WithoutGenericAny<RootQuerySelector<S>>;
|
||||
|
||||
type THydratedDocument<T> = TOmitId<HydratedDocument<T>>;
|
||||
}
|
||||
|
||||
declare global {
|
||||
type HyphenToUnderscore<S extends string> = S extends `${infer P}-${infer Q}`
|
||||
? `${P}_${HyphenToUnderscore<Q>}`
|
||||
|
||||
Reference in New Issue
Block a user