syuilo / ai

💕 A bot for Misskey
https://藍.moe/
MIT License
234 stars 114 forks source link

npm buildが失敗する #129

Closed mendakon closed 9 months ago

mendakon commented 9 months ago

五月雨式にすみません 非Docker ubuntu node v20.11.0

root@localhost:~/aitemp/ai# npm run build

> build
> tspc

src/ai.ts:45:9 - error TS2564: Property 'connection' has no initializer and is not definitely assigned in the constructor.

45  public connection: Stream;
           ~~~~~~~~~~

src/ai.ts:51:9 - error TS2564: Property 'lastSleepedAt' has no initializer and is not definitely assigned in the constructor.

51  public lastSleepedAt: number;
           ~~~~~~~~~~~~~

src/ai.ts:53:10 - error TS2564: Property 'meta' has no initializer and is not definitely assigned in the constructor.

53  private meta: loki.Collection<Meta>;
            ~~~~

src/ai.ts:55:10 - error TS2564: Property 'contexts' has no initializer and is not definitely assigned in the constructor.

55  private contexts: loki.Collection<{
            ~~~~~~~~

src/ai.ts:63:10 - error TS2564: Property 'timers' has no initializer and is not definitely assigned in the constructor.

63  private timers: loki.Collection<{
            ~~~~~~

src/ai.ts:71:9 - error TS2564: Property 'friends' has no initializer and is not definitely assigned in the constructor.

71  public friends: loki.Collection<FriendDoc>;
           ~~~~~~~

src/ai.ts:72:9 - error TS2564: Property 'moduleData' has no initializer and is not definitely assigned in the constructor.

72  public moduleData: loki.Collection<any>;
           ~~~~~~~~~~

src/ai.ts:349:4 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Object literal may only specify known properties, and 'formData' does not exist in type 'OptionsInit'.

349    formData: {
       ~~~~~~~~

  node_modules/got/dist/source/types.d.ts:171:5
    171     (options: OptionsInit): CancelableRequest | Request;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The last overload is declared here.

src/ai.ts:367:10 - error TS18046: 'res' is of type 'unknown'.

367   return res.createdNote;
             ~~~

src/config.ts:22:8 - error TS2339: Property 'wsUrl' does not exist on type '{ host: string; i: string; master: string; notingEnabled: boolean; keywordEnabled: boolean; chartEnabled: boolean; reversiEnabled: boolean; serverMonitoring: boolean; checkEmojisEnabled: boolean; checkEmojisAtOnce: boolean; mecab: string; mecabDic: string; }'.

22 config.wsUrl = config.host.replace('http', 'ws');
          ~~~~~

src/config.ts:23:8 - error TS2339: Property 'apiUrl' does not exist on type '{ host: string; i: string; master: string; notingEnabled: boolean; keywordEnabled: boolean; chartEnabled: boolean; reversiEnabled: boolean; serverMonitoring: boolean; checkEmojisEnabled: boolean; checkEmojisAtOnce: boolean; mecab: string; mecabDic: string; }'.

23 config.apiUrl = config.host + '/api';
          ~~~~~~

src/index.ts:60:19 - error TS18046: 'account' is of type 'unknown'.

60  const acct = `@${account.username}`;
                     ~~~~~~~

src/index.ts:66:8 - error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'User'.

66  new 藍(account, [
          ~~~~~~~

src/message.ts:67:27 - error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Partial<User>'.

67    this.friend.updateUser(user);
                             ~~~~

src/module.ts:7:12 - error TS2564: Property 'ai' has no initializer and is not definitely assigned in the constructor.

7  protected ai: 藍;
             ~~

src/modules/chart/index.ts:60:12 - error TS18046: 'data' is of type 'unknown'.

60      data: data.diffs.normal
              ~~~~

src/modules/chart/index.ts:62:12 - error TS18046: 'data' is of type 'unknown'.

62      data: data.diffs.reply
              ~~~~

src/modules/chart/index.ts:64:12 - error TS18046: 'data' is of type 'unknown'.

64      data: data.diffs.renote
              ~~~~

src/modules/chart/index.ts:77:12 - error TS18046: 'data' is of type 'unknown'.

77      data: data.local.followers.total
              ~~~~

src/modules/chart/index.ts:79:12 - error TS18046: 'data' is of type 'unknown'.

79      data: data.remote.followers.total
              ~~~~

src/modules/chart/index.ts:90:12 - error TS18046: 'data' is of type 'unknown'.

90      data: data.local.diffs.normal
              ~~~~

src/modules/chart/index.ts:92:12 - error TS18046: 'data' is of type 'unknown'.

92      data: data.local.diffs.reply
              ~~~~

src/modules/chart/index.ts:94:12 - error TS18046: 'data' is of type 'unknown'.

94      data: data.local.diffs.renote
              ~~~~

src/modules/check-custom-emojis/index.ts:11:10 - error TS2564: Property 'lastEmoji' has no initializer and is not definitely assigned in the constructor.

11  private lastEmoji: loki.Collection<{
            ~~~~~~~~~

src/modules/emoji-react/index.ts:13:10 - error TS2564: Property 'htl' has no initializer and is not definitely assigned in the constructor.

13  private htl: ReturnType<Stream['useSharedConnection']>;
            ~~~

src/modules/guessing-game/index.ts:10:10 - error TS2564: Property 'guesses' has no initializer and is not definitely assigned in the constructor.

10  private guesses: loki.Collection<{
            ~~~~~~~

src/modules/kazutori/index.ts:28:10 - error TS2564: Property 'games' has no initializer and is not definitely assigned in the constructor.

28  private games: loki.Collection<Game>;
            ~~~~~

src/modules/keyword/index.ts:18:10 - error TS2564: Property 'learnedKeywords' has no initializer and is not definitely assigned in the constructor.

18  private learnedKeywords: loki.Collection<{
            ~~~~~~~~~~~~~~~

src/modules/keyword/index.ts:42:27 - error TS18046: 'tl' is of type 'unknown'.

42   const interestedNotes = tl.filter(note =>
                             ~~

src/modules/poll/index.ts:107:9 - error TS2322: Type 'unknown' is not assignable to type 'Note'.

107   const note: Note = await this.ai.api('notes/show', { noteId });
            ~~~~

src/modules/reminder/index.ts:14:10 - error TS2564: Property 'reminds' has no initializer and is not definitely assigned in the constructor.

14  private reminds: loki.Collection<{
            ~~~~~~~

src/modules/reminder/index.ts:152:8 - error TS18046: 'err' is of type 'unknown'.

152    if (err.statusCode === 400) {
           ~~~

src/modules/reversi/back.ts:27:10 - error TS2564: Property 'account' has no initializer and is not definitely assigned in the constructor.

27  private account: User;
            ~~~~~~~

src/modules/reversi/back.ts:30:10 - error TS2564: Property 'engine' has no initializer and is not definitely assigned in the constructor.

30  private engine: Reversi.Game;
            ~~~~~~

src/modules/reversi/back.ts:31:10 - error TS2564: Property 'botColor' has no initializer and is not definitely assigned in the constructor.

31  private botColor: Reversi.Color;
            ~~~~~~~~

src/modules/reversi/back.ts:458:12 - error TS18046: 'res' is of type 'unknown'.

458     return res.createdNote;
               ~~~

src/modules/server/index.ts:12:10 - error TS2564: Property 'lastWarnedAt' has no initializer and is not definitely assigned in the constructor.

12  private lastWarnedAt: number;
            ~~~~~~~~~~~~

Found 37 errors in 15 files.

Errors  Files
     9  src/ai.ts:45
       2  src/config.ts:22
       2  src/index.ts:60
       1  src/message.ts:67
       1  src/module.ts:7
       8  src/modules/chart/index.ts:60
       1  src/modules/check-custom-emojis/index.ts:11
       1  src/modules/emoji-react/index.ts:13
       1  src/modules/guessing-game/index.ts:10
       1  src/modules/kazutori/index.ts:28
       2  src/modules/keyword/index.ts:18
       1  src/modules/poll/index.ts:107
       2  src/modules/reminder/index.ts:14
       4  src/modules/reversi/back.ts:27
       1  src/modules/server/index.ts:12\
syuilo commented 9 months ago

これは仕様

mendakon commented 9 months ago

手順はreadme通りだと思うんですが、実際はどうやってビルドするのが正解ですか?

sousuke0422 commented 9 months ago

宣言時に初期化されてないだけだから無視でいいかと

na2na-p commented 9 months ago

@mendakon 直感に反しているどころかCommand failedしてるのはそうだけど「型エラー出ているが、ビルド成果物は出来上がっているため無視する」ということのようです

image
mendakon commented 9 months ago

起動できました!ありがとうございます!