Skip to content

Commit 6747f59

Browse files
committed
Revert "RequiredProp"
This reverts commit 7469390.
1 parent 7469390 commit 6747f59

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/backend/src/misc/schema.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ export type Obj = Record<string, Schema>;
116116
// https://github.com/misskey-dev/misskey/issues/8535
117117
// To avoid excessive stack depth error,
118118
// deceive TypeScript with UnionToIntersection (or more precisely, `infer` expression within it).
119-
export type ObjType<s extends Obj, RequiredProp extends keyof s> =
119+
export type ObjType<s extends Obj, RequiredProps extends ReadonlyArray<keyof s>> =
120120
UnionToIntersection<
121121
{ -readonly [R in RequiredPropertyNames<s>]-?: SchemaType<s[R]> } &
122-
{ -readonly [R in RequiredProp]-?: SchemaType<s[R]> } &
122+
{ -readonly [R in RequiredProps[number]]-?: SchemaType<s[R]> } &
123123
{ -readonly [P in keyof s]?: SchemaType<s[P]> }
124124
>;
125125

@@ -137,16 +137,16 @@ type PartialIntersection<T> = Partial<UnionToIntersection<T>>;
137137
// To get union, we use `Foo extends any ? Hoge<Foo> : never`
138138
type UnionSchemaType<a extends readonly any[], X extends Schema = a[number]> = X extends any ? SchemaType<X> : never;
139139
//type UnionObjectSchemaType<a extends readonly any[], X extends Schema = a[number]> = X extends any ? ObjectSchemaType<X> : never;
140-
type UnionObjType<s extends Obj, a extends readonly any[], X extends ReadonlyArray<keyof s> = a[number]> = X extends any ? ObjType<s, X[number]> : never;
140+
type UnionObjType<s extends Obj, a extends readonly any[], X extends ReadonlyArray<keyof s> = a[number]> = X extends any ? ObjType<s, X> : never;
141141
type ArrayUnion<T> = T extends any ? Array<T> : never;
142142

143143
type ObjectSchemaTypeDef<p extends Schema> =
144144
p['ref'] extends keyof typeof refs ? Packed<p['ref']> :
145145
p['properties'] extends NonNullable<Obj> ?
146146
p['anyOf'] extends ReadonlyArray<Schema> ? p['anyOf'][number]['required'] extends ReadonlyArray<keyof p['properties']> ?
147-
UnionObjType<p['properties'], NonNullable<p['anyOf'][number]['required']>> & ObjType<p['properties'], NonNullable<p['required']>[number]>
147+
UnionObjType<p['properties'], NonNullable<p['anyOf'][number]['required']>> & ObjType<p['properties'], NonNullable<p['required']>>
148148
: never
149-
: ObjType<p['properties'], NonNullable<p['required']>[number]>
149+
: ObjType<p['properties'], NonNullable<p['required']>>
150150
:
151151
p['anyOf'] extends ReadonlyArray<Schema> ? never : // see CONTRIBUTING.md
152152
p['allOf'] extends ReadonlyArray<Schema> ? UnionToIntersection<UnionSchemaType<p['allOf']>> :

0 commit comments

Comments
 (0)