summaryrefslogtreecommitdiff
path: root/src/prelude/array.ts
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2020-05-23 13:19:31 +0900
committerGitHub <noreply@github.com>2020-05-23 13:19:31 +0900
commit3963ed8ff7488a0e2f7f3876461f909e6be08e25 (patch)
treed019d1d294e8ca757479dc638f977ae10b5f44da /src/prelude/array.ts
parentfix(i18n): Fix missing translation (diff)
downloadmisskey-3963ed8ff7488a0e2f7f3876461f909e6be08e25.tar.gz
misskey-3963ed8ff7488a0e2f7f3876461f909e6be08e25.tar.bz2
misskey-3963ed8ff7488a0e2f7f3876461f909e6be08e25.zip
feat(client): 翻訳をIndexedDBに保存・プッシュ通知を翻訳 (#6396)
* wip * tabun ok * better msg * oops * fix lint * Update gulpfile.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * Update src/client/scripts/set-i18n-contexts.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * refactor Co-authored-by: acid-chicken <root@acid-chicken.com> * ✨ * wip * fix lint * たぶんおk * fix flush * Translate Notification * remove console.log * fix * add notifications * remove san * wip * ok * :v: * Update src/prelude/array.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> * wip * i18n refactor * Update init.ts * :v: Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
Diffstat (limited to '')
-rw-r--r--src/prelude/array.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/prelude/array.ts b/src/prelude/array.ts
index f4d684d574..9e1dfead53 100644
--- a/src/prelude/array.ts
+++ b/src/prelude/array.ts
@@ -130,7 +130,17 @@ export function cumulativeSum(xs: number[]): number[] {
}
// Object.fromEntries()
-export function fromEntries(xs: [string, any][]): { [x: string]: any; } {
+export function fromEntries<T extends readonly (readonly [PropertyKey, any])[]>(xs: T):
+ T[number] extends infer U
+ ?
+ (
+ U extends readonly any[]
+ ? (x: { [_ in U[0]]: U[1] }) => any
+ : never
+ ) extends (x: infer V) => any
+ ? V
+ : never
+ : never {
return xs.reduce((obj, [k, v]) => Object.assign(obj, { [k]: v }), {} as { [x: string]: any; });
}