aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-24 16:48:54 +0200
committerChocobozzz <me@florianbigard.com>2023-05-24 16:56:05 +0200
commit54909304287f3c04dcfb39660be8ead57dc95440 (patch)
tree478f1b913f3bd4c3bbaa17525f0114c5b0a8689d /shared
parentd0fbc9fd0a29c37f3ff9b99030351e90b276fe7d (diff)
downloadPeerTube-54909304287f3c04dcfb39660be8ead57dc95440.tar.gz
PeerTube-54909304287f3c04dcfb39660be8ead57dc95440.tar.zst
PeerTube-54909304287f3c04dcfb39660be8ead57dc95440.zip
Remove suppressImplicitAnyIndexErrors
It's deprecated by TS
Diffstat (limited to 'shared')
-rw-r--r--shared/core-utils/common/object.ts10
-rw-r--r--shared/core-utils/i18n/i18n.ts4
-rw-r--r--shared/core-utils/renderer/html.ts2
-rw-r--r--shared/models/videos/playlist/video-exist-in-playlist.model.ts4
4 files changed, 15 insertions, 5 deletions
diff --git a/shared/core-utils/common/object.ts b/shared/core-utils/common/object.ts
index 9780b2594..1276bfcc7 100644
--- a/shared/core-utils/common/object.ts
+++ b/shared/core-utils/common/object.ts
@@ -23,10 +23,18 @@ function omit <O extends object, K extends keyof O> (object: O, keys: K[]): Excl
23 return result 23 return result
24} 24}
25 25
26function objectKeysTyped <O extends object, K extends keyof O> (object: O): K[] {
27 return (Object.keys(object) as K[])
28}
29
26function getKeys <O extends object, K extends keyof O> (object: O, keys: K[]): K[] { 30function getKeys <O extends object, K extends keyof O> (object: O, keys: K[]): K[] {
27 return (Object.keys(object) as K[]).filter(k => keys.includes(k)) 31 return (Object.keys(object) as K[]).filter(k => keys.includes(k))
28} 32}
29 33
34function hasKey <T extends object> (obj: T, k: keyof any): k is keyof T {
35 return k in obj
36}
37
30function sortObjectComparator (key: string, order: 'asc' | 'desc') { 38function sortObjectComparator (key: string, order: 'asc' | 'desc') {
31 return (a: any, b: any) => { 39 return (a: any, b: any) => {
32 if (a[key] < b[key]) { 40 if (a[key] < b[key]) {
@@ -69,7 +77,9 @@ function simpleObjectsDeepEqual (a: any, b: any) {
69export { 77export {
70 pick, 78 pick,
71 omit, 79 omit,
80 objectKeysTyped,
72 getKeys, 81 getKeys,
82 hasKey,
73 shallowCopy, 83 shallowCopy,
74 sortObjectComparator, 84 sortObjectComparator,
75 simpleObjectsDeepEqual 85 simpleObjectsDeepEqual
diff --git a/shared/core-utils/i18n/i18n.ts b/shared/core-utils/i18n/i18n.ts
index 38c1b0cc9..54b54077a 100644
--- a/shared/core-utils/i18n/i18n.ts
+++ b/shared/core-utils/i18n/i18n.ts
@@ -103,9 +103,9 @@ export function is18nLocale (locale: string) {
103export function getCompleteLocale (locale: string) { 103export function getCompleteLocale (locale: string) {
104 if (!locale) return locale 104 if (!locale) return locale
105 105
106 if (I18N_LOCALE_ALIAS[locale]) return I18N_LOCALE_ALIAS[locale] 106 const found = (I18N_LOCALE_ALIAS as any)[locale] as string
107 107
108 return locale 108 return found || locale
109} 109}
110 110
111export function getShortLocale (locale: string) { 111export function getShortLocale (locale: string) {
diff --git a/shared/core-utils/renderer/html.ts b/shared/core-utils/renderer/html.ts
index 877f2ec55..365bf7612 100644
--- a/shared/core-utils/renderer/html.ts
+++ b/shared/core-utils/renderer/html.ts
@@ -56,7 +56,7 @@ export function getCustomMarkupSanitizeOptions (additionalAllowedTags: string[]
56export function escapeHTML (stringParam: string) { 56export function escapeHTML (stringParam: string) {
57 if (!stringParam) return '' 57 if (!stringParam) return ''
58 58
59 const entityMap = { 59 const entityMap: { [id: string ]: string } = {
60 '&': '&amp;', 60 '&': '&amp;',
61 '<': '&lt;', 61 '<': '&lt;',
62 '>': '&gt;', 62 '>': '&gt;',
diff --git a/shared/models/videos/playlist/video-exist-in-playlist.model.ts b/shared/models/videos/playlist/video-exist-in-playlist.model.ts
index bc803a99c..6d06c0f4d 100644
--- a/shared/models/videos/playlist/video-exist-in-playlist.model.ts
+++ b/shared/models/videos/playlist/video-exist-in-playlist.model.ts
@@ -1,8 +1,8 @@
1export type VideosExistInPlaylists = { 1export type VideosExistInPlaylists = {
2 [videoId: number ]: VideoExistInPlaylist[] 2 [videoId: number]: VideoExistInPlaylist[]
3} 3}
4export type CachedVideosExistInPlaylists = { 4export type CachedVideosExistInPlaylists = {
5 [videoId: number ]: CachedVideoExistInPlaylist[] 5 [videoId: number]: CachedVideoExistInPlaylist[]
6} 6}
7 7
8export type CachedVideoExistInPlaylist = { 8export type CachedVideoExistInPlaylist = {