From 74693900119a590263106fa3adefd008d69ce80c Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 25 Feb 2023 11:07:00 +0000 Subject: [PATCH] RequiredProp --- packages/backend/src/misc/schema.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/misc/schema.ts b/packages/backend/src/misc/schema.ts index 6a0802f8a4..7630da8934 100644 --- a/packages/backend/src/misc/schema.ts +++ b/packages/backend/src/misc/schema.ts @@ -116,10 +116,10 @@ export type Obj = Record; // https://github.com/misskey-dev/misskey/issues/8535 // To avoid excessive stack depth error, // deceive TypeScript with UnionToIntersection (or more precisely, `infer` expression within it). -export type ObjType> = +export type ObjType = UnionToIntersection< { -readonly [R in RequiredPropertyNames]-?: SchemaType } & - { -readonly [R in RequiredProps[number]]-?: SchemaType } & + { -readonly [R in RequiredProp]-?: SchemaType } & { -readonly [P in keyof s]?: SchemaType } >; @@ -137,16 +137,16 @@ type PartialIntersection = Partial>; // To get union, we use `Foo extends any ? Hoge : never` type UnionSchemaType = X extends any ? SchemaType : never; //type UnionObjectSchemaType = X extends any ? ObjectSchemaType : never; -type UnionObjType = a[number]> = X extends any ? ObjType : never; +type UnionObjType = a[number]> = X extends any ? ObjType : never; type ArrayUnion = T extends any ? Array : never; type ObjectSchemaTypeDef

= p['ref'] extends keyof typeof refs ? Packed : p['properties'] extends NonNullable ? p['anyOf'] extends ReadonlyArray ? p['anyOf'][number]['required'] extends ReadonlyArray ? - UnionObjType> & ObjType> + UnionObjType> & ObjType[number]> : never - : ObjType> + : ObjType[number]> : p['anyOf'] extends ReadonlyArray ? never : // see CONTRIBUTING.md p['allOf'] extends ReadonlyArray ? UnionToIntersection> :