From 68ee9a008e987b9a7dc1f9cf1fc010f9b9ed0f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Mon, 4 Feb 2019 18:27:45 +0900 Subject: [PATCH] Resolve #4121 (#4122) * Resolve #4121 * Update tslint.json --- src/chart/index.ts | 2 +- src/models/games/reversi/game.ts | 4 ++-- src/models/note.ts | 4 ++-- src/server/api/endpoints/aggregation/hashtags.ts | 8 ++++---- src/server/api/endpoints/hashtags/trend.ts | 10 +++++----- src/server/api/stream/channels/hashtag.ts | 2 +- src/server/web/docs.ts | 2 +- src/services/drive/add-file.ts | 2 +- src/services/note/create.ts | 4 ++-- tslint.json | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/chart/index.ts b/src/chart/index.ts index 5c1956a44..ce5d8b99a 100644 --- a/src/chart/index.ts +++ b/src/chart/index.ts @@ -21,7 +21,7 @@ export type Partial = { }; type ArrayValue = { - [P in keyof T]: T[P] extends number ? Array : ArrayValue; + [P in keyof T]: T[P] extends number ? T[P][] : ArrayValue; }; type Span = 'day' | 'hour'; diff --git a/src/models/games/reversi/game.ts b/src/models/games/reversi/game.ts index e0d1ad1be..57c493cff 100644 --- a/src/models/games/reversi/game.ts +++ b/src/models/games/reversi/game.ts @@ -27,11 +27,11 @@ export interface IReversiGame { isEnded: boolean; winnerId: mongo.ObjectID; surrendered: mongo.ObjectID; - logs: Array<{ + logs: { at: Date; color: boolean; pos: number; - }>; + }[]; settings: { map: string[]; bw: string | number; diff --git a/src/models/note.ts b/src/models/note.ts index b3d5ed697..ce886f51c 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -52,11 +52,11 @@ export type INote = { repliesCount: number; reactionCounts: any; mentions: mongo.ObjectID[]; - mentionedRemoteUsers: Array<{ + mentionedRemoteUsers: { uri: string; username: string; host: string; - }>; + }[]; /** * public ... 公開 diff --git a/src/server/api/endpoints/aggregation/hashtags.ts b/src/server/api/endpoints/aggregation/hashtags.ts index 7577711b5..13d0e1e2a 100644 --- a/src/server/api/endpoints/aggregation/hashtags.ts +++ b/src/server/api/endpoints/aggregation/hashtags.ts @@ -29,22 +29,22 @@ export default define(meta, (ps) => new Promise(async (res, rej) => { $group: { _id: { tag: '$tagsLower', userId: '$userId' } } - }]) as Array<{ + }]) as { _id: { tag: string; userId: any; } - }>; + }[]; //#endregion if (data.length == 0) { return res([]); } - let tags: Array<{ + let tags: { name: string; count: number; - }> = []; + }[] = []; // カウント for (const x of data.map(x => x._id).filter(x => !hidedTags.includes(x.tag))) { diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts index a26dbf094..d4efe5d91 100644 --- a/src/server/api/endpoints/hashtags/trend.ts +++ b/src/server/api/endpoints/hashtags/trend.ts @@ -40,22 +40,22 @@ export default define(meta, () => new Promise(async (res, rej) => { $group: { _id: { tag: '$tagsLower', userId: '$userId' } } - }]) as Array<{ + }]) as { _id: { tag: string; userId: any; } - }>; + }[]; //#endregion if (data.length == 0) { return res([]); } - const tags: Array<{ + const tags: { name: string; count: number; - }> = []; + }[] = []; // カウント for (const x of data.map(x => x._id).filter(x => !hidedTags.includes(x.tag))) { @@ -108,7 +108,7 @@ export default define(meta, () => new Promise(async (res, rej) => { //#endregion //#region 2(または3)で話題と判定されたタグそれぞれについて過去の投稿数グラフを取得する - const countPromises: Array> = []; + const countPromises: Promise[] = []; const range = 20; diff --git a/src/server/api/stream/channels/hashtag.ts b/src/server/api/stream/channels/hashtag.ts index c8b6c578d..586ce02f0 100644 --- a/src/server/api/stream/channels/hashtag.ts +++ b/src/server/api/stream/channels/hashtag.ts @@ -14,7 +14,7 @@ export default class extends Channel { const mute = this.user ? await Mute.find({ muterId: this.user._id }) : null; const mutedUserIds = mute ? mute.map(m => m.muteeId.toString()) : []; - const q: Array = params.q; + const q: string[][] = params.q; if (q == null) return; diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index 0597f50a9..dd37b9821 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -121,7 +121,7 @@ const parsePropDefinition = (key: string, prop: any) => { return prop; }; -const sortParams = (params: Array<{ name: string }>) => { +const sortParams = (params: { name: string }[]) => { return params; }; diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index 190c55afb..b360df099 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -429,7 +429,7 @@ export default async function( const properties: {[key: string]: any} = {}; - let propPromises: Array> = []; + let propPromises: Promise[] = []; const isImage = ['image/jpeg', 'image/gif', 'image/png', 'image/webp'].includes(mime); diff --git a/src/services/note/create.ts b/src/services/note/create.ts index fa1a23900..7b6120b1e 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -38,10 +38,10 @@ type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; class NotificationManager { private notifier: IUser; private note: INote; - private queue: Array<{ + private queue: { target: ILocalUser['_id']; reason: NotificationType; - }>; + }[]; constructor(notifier: IUser, note: INote) { this.notifier = notifier; diff --git a/tslint.json b/tslint.json index 7c1f2a676..d7d9f2b56 100644 --- a/tslint.json +++ b/tslint.json @@ -18,7 +18,7 @@ "no-empty":false, "ordered-imports": [false], "arrow-parens": false, - "array-type": false, + "array-type": [true, "array"], "object-literal-shorthand": false, "object-literal-key-quotes": false, "triple-equals": [false],