misskey/packages/sw/src/types.ts
okayurisotto 5002effd65
Refactor sw (#10579)
* refactor(sw): remove dead code

* refactor(sw): remove dead code

* refactor(sw): remove dead code

* refactor(sw): remove dead code

* refactor(sw): remove dead code

* refactor(sw): remove dead code

* refactor(sw): 冗長な部分を変更

* refactor(sw): 使われていない煩雑な機能を削除

* refactor(sw): remove dead code

* refactor(sw): URL文字列の作成に`URL`を使うように

* refactor(sw): 型アサーションの削除とそれに伴い露呈したエラーへの対処

* refactor(sw): `append` -> `set` in `URLSearchParams`

* refactor(sw): `any`の削除とそれに伴い露呈したエラーへの対処

* refactor(sw): 型アサーションの削除とそれに伴い露呈したエラーへの対処

対処と言っても`throw`するだけ。いままでもこの状況ではエラーが投げられていたはずなので、この対処により新たな問題が起きることはないはず。

* refactor(sw): i18n loading

* refactor(sw): 型推論がうまくできる書き方に変更

`codes`が`(string | undefined)[]`から`string[]`になった

* refactor(sw): クエリ文字列の作成に`URLSearchParams`を使うように

* refactor(sw): `findClient`

* refactor(sw): `openClient`における`any`や`as`の書き換え

* refactor(sw): `openPost`における`any`の書き換え

* refactor(sw): `let` -> `const`

* refactor(sw): `any` -> `unknown`

* cleanup(sw): import

* cleanup(sw)

* cleanup(sw): `?.`

* cleanup(sw/.eslintrc.js)

* refactor(sw): `@typescript-eslint/explicit-function-return-type`

* refactor(sw): `@typescript-eslint/no-unused-vars`

* refactor(sw): どうしようもないところに`eslint-disable-next-line`を

* refactor(sw): `import/no-default-export`

* update operations.ts

* throw new Error

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-04-12 01:07:24 +09:00

48 lines
986 B
TypeScript

import type * as Misskey from 'misskey-js';
export type SwMessageOrderType = 'post' | 'push';
export type SwMessage = {
type: 'order';
order: SwMessageOrderType;
loginId?: string;
url: string;
[x: string]: unknown;
};
// Defined also @/core/PushNotificationService.ts#L12
type PushNotificationDataSourceMap = {
notification: Misskey.entities.Notification;
unreadAntennaNote: {
antenna: { id: string; name: string };
note: Misskey.entities.Note;
};
readAllNotifications: undefined;
};
export type PushNotificationData<K extends keyof PushNotificationDataSourceMap> = {
type: K;
body: PushNotificationDataSourceMap[K];
userId: string;
dateTime: number;
};
export type PushNotificationDataMap = {
[K in keyof PushNotificationDataSourceMap]: PushNotificationData<K>;
};
export type BadgeNames =
| 'null'
| 'antenna'
| 'arrow-back-up'
| 'at'
| 'chart-arrows'
| 'circle-check'
| 'medal'
| 'messages'
| 'plus'
| 'quote'
| 'repeat'
| 'user-plus'
| 'users';