mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-10 00:08:22 +03:00
Merge pull request #257 from zkldi:zkldi/issue-205-Type-monk-options-projectID-properly
zkldi/issue-205-Type-monk-options-projectID-properly
This commit is contained in:
+12
-12
@@ -2,17 +2,17 @@
|
||||
// this is a hack fix for express-request-mock's lack of typing.
|
||||
|
||||
declare module "express-request-mock" {
|
||||
import { Request, RequestHandler, Response } from "express";
|
||||
import { RequestOptions, MockResponse } from "node-mocks-http";
|
||||
import { Request, RequestHandler, Response } from "express";
|
||||
import { RequestOptions, MockResponse } from "node-mocks-http";
|
||||
|
||||
export default function (
|
||||
callback: RequestHandler,
|
||||
options?: RequestOptions,
|
||||
decorators?: Record<string, unknown>
|
||||
): Promise<{
|
||||
req: Request;
|
||||
res: MockResponse<Response<any, Record<string, any>>>;
|
||||
request: Request;
|
||||
response: MockResponse<Response<any, Record<string, any>>>;
|
||||
}>;
|
||||
export default function (
|
||||
callback: RequestHandler,
|
||||
options?: RequestOptions,
|
||||
decorators?: Record<string, unknown>
|
||||
): Promise<{
|
||||
req: Request;
|
||||
res: MockResponse<Response<any, Record<string, any>>>;
|
||||
request: Request;
|
||||
response: MockResponse<Response<any, Record<string, any>>>;
|
||||
}>;
|
||||
}
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
declare module "mongodb" {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface FindOneOptions<T> {
|
||||
projectID?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
declare module "why-is-node-running" {
|
||||
export default function log(): void;
|
||||
export default function log(): void;
|
||||
}
|
||||
|
||||
Vendored
-3
@@ -9,21 +9,18 @@ t.test("ID field autoprojection", async (t) => {
|
||||
const res = await db.scores.findOne();
|
||||
t.equal(res!._id, undefined);
|
||||
|
||||
// @ts-expect-error todo: #205 type properly
|
||||
const res2 = await db.scores.findOne({}, { projectID: true });
|
||||
t.not(res2!._id, undefined);
|
||||
|
||||
const res3 = await db.scores.findOne({}, { projection: { scoreID: 1 } });
|
||||
t.equal(res3!._id, undefined);
|
||||
|
||||
// @ts-expect-error todo: #205 type properly
|
||||
const res4 = await db.scores.findOne({}, { projection: { scoreID: 1 }, projectID: true });
|
||||
t.not(res4!._id, undefined);
|
||||
|
||||
const res5 = await db.scores.findOne({}, { projection: { scoreID: 0 } });
|
||||
t.equal(res5!._id, undefined);
|
||||
|
||||
// @ts-expect-error todo: #205 type properly
|
||||
const res6 = await db.scores.findOne({}, { projection: { scoreID: 0 }, projectID: true });
|
||||
t.not(res6!._id, undefined);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user