forked from mirror/misskey
wip
This commit is contained in:
parent
995635dd27
commit
48b1abffbe
@ -299,6 +299,27 @@ pnpm dlx typeorm migration:generate -d ormconfig.js -o <migration name>
|
|||||||
- 生成後、ファイルをmigration下に移してください
|
- 生成後、ファイルをmigration下に移してください
|
||||||
- 作成されたスクリプトは不必要な変更を含むため除去してください
|
- 作成されたスクリプトは不必要な変更を含むため除去してください
|
||||||
|
|
||||||
|
### JSON SchemaのobjectでanyOfを使うとき
|
||||||
|
JSON Schemaで、objectに対してanyOfを使う場合、anyOfの中でpropertiesを定義しないこと。
|
||||||
|
バリデーションが効かないため。(SchemaTypeもそのように作られており、objectのanyOf内のpropertiesは捨てられます)
|
||||||
|
https://github.com/misskey-dev/misskey/pull/10082
|
||||||
|
|
||||||
|
テキストhogeおよびfugaについて、片方を必須としつつ両方の指定もありうる場合:
|
||||||
|
|
||||||
|
```
|
||||||
|
export const paramDef = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
hoge: { type: 'string', minLength: 1 },
|
||||||
|
fuga: { type: 'string', minLength: 1 },
|
||||||
|
},
|
||||||
|
anyOf: [
|
||||||
|
{ required: ['hoge'] },
|
||||||
|
{ required: ['fuga'] },
|
||||||
|
],
|
||||||
|
} as const;
|
||||||
|
```
|
||||||
|
|
||||||
### コネクションには`markRaw`せよ
|
### コネクションには`markRaw`せよ
|
||||||
**Vueのコンポーネントのdataオプションとして**misskey.jsのコネクションを設定するとき、必ず`markRaw`でラップしてください。インスタンスが不必要にリアクティブ化されることで、misskey.js内の処理で不具合が発生するとともに、パフォーマンス上の問題にも繋がる。なお、Composition APIを使う場合はこの限りではない(リアクティブ化はマニュアルなため)。
|
**Vueのコンポーネントのdataオプションとして**misskey.jsのコネクションを設定するとき、必ず`markRaw`でラップしてください。インスタンスが不必要にリアクティブ化されることで、misskey.js内の処理で不具合が発生するとともに、パフォーマンス上の問題にも繋がる。なお、Composition APIを使う場合はこの限りではない(リアクティブ化はマニュアルなため)。
|
||||||
|
|
||||||
|
@ -142,10 +142,10 @@ type ArrayUnion<T> = T extends any ? Array<T> : never;
|
|||||||
type ObjectSchemaTypeDef<p extends Schema> =
|
type ObjectSchemaTypeDef<p extends Schema> =
|
||||||
p['ref'] extends keyof typeof refs ? Packed<p['ref']> :
|
p['ref'] extends keyof typeof refs ? Packed<p['ref']> :
|
||||||
p['properties'] extends NonNullable<Obj> ?
|
p['properties'] extends NonNullable<Obj> ?
|
||||||
p['anyOf'] extends ReadonlyArray<Schema> ?
|
p['anyOf'] extends ReadonlyArray<Schema> ? p['anyOf'][number]['required'] extends ReadonlyArray<keyof NonNullable<p['properties']>> ?
|
||||||
ObjType<p['properties'], NonNullable<p['required']>[number]> & UnionObjectSchemaType<p['anyOf']> & PartialIntersection<UnionObjectSchemaType<p['anyOf']>>
|
ObjType<p['properties'], NonNullable<p['required']>[number]> & ObjType<p['properties'], p['anyOf'][number]['required'][number]>
|
||||||
:
|
: never
|
||||||
ObjType<p['properties'], NonNullable<p['required']>[number]>
|
: ObjType<p['properties'], NonNullable<p['required']>[number]>
|
||||||
:
|
:
|
||||||
p['anyOf'] extends ReadonlyArray<Schema> ? UnionObjectSchemaType<p['anyOf']> & PartialIntersection<UnionObjectSchemaType<p['anyOf']>> :
|
p['anyOf'] extends ReadonlyArray<Schema> ? UnionObjectSchemaType<p['anyOf']> & PartialIntersection<UnionObjectSchemaType<p['anyOf']>> :
|
||||||
p['allOf'] extends ReadonlyArray<Schema> ? UnionToIntersection<UnionSchemaType<p['allOf']>> :
|
p['allOf'] extends ReadonlyArray<Schema> ? UnionToIntersection<UnionSchemaType<p['allOf']>> :
|
||||||
|
Loading…
Reference in New Issue
Block a user