SchemaTypeの型計算量を削減 (#8332)

* schema typeの型計算量を削減

* reduce some type error

* wip

* fix

* clean up

* more shrink
This commit is contained in:
tamaina 2022-02-19 23:21:28 +09:00 committed by GitHub
parent b6db709e02
commit fd8f8162e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 57 additions and 105 deletions

View file

@ -14,12 +14,12 @@ export const meta = {
properties: {
state: {
type: 'string',
optional: false, nullable: false,
optional: true, nullable: false,
enum: ['already-subscribed', 'subscribed'],
},
key: {
type: 'string',
optional: false, nullable: false,
optional: false, nullable: true,
},
},
},
@ -49,7 +49,7 @@ export default define(meta, paramDef, async (ps, user) => {
if (exist != null) {
return {
state: 'already-subscribed',
state: 'already-subscribed' as const,
key: instance.swPublicKey,
};
}
@ -64,7 +64,7 @@ export default define(meta, paramDef, async (ps, user) => {
});
return {
state: 'subscribed',
state: 'subscribed' as const,
key: instance.swPublicKey,
};
});