Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building in node v21 #133

Open
temtemy opened this issue Feb 24, 2024 · 4 comments
Open

Error building in node v21 #133

temtemy opened this issue Feb 24, 2024 · 4 comments

Comments

@temtemy
Copy link

temtemy commented Feb 24, 2024

I'm running Arch Linux and Node.js v21.6.2. npm run build fails with 36 errors.

Log:

[misskey@chaotic ai]$ npm run build

> build
> tspc

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

46  public connection: Stream;
           ~~~~~~~~~~

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

52  public lastSleepedAt: number;
           ~~~~~~~~~~~~~

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

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

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

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

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

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

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

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

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

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

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

365   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; mecab: string; mecabDic: string; memoryDir: 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; mecab: string; mecabDic: string; memoryDir: string; }'.

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

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

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

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

74  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:459:12 - error TS18046: 'res' is of type 'unknown'.

459     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 36 errors in 15 files.

Errors  Files
     8  src/ai.ts:46
       2  src/config.ts:22
       2  src/index.ts:68
       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
@16439s
Copy link

16439s commented Mar 9, 2024

これについては 私の環境でも、同じエラーが出ています。
確認しているバージョンは以下の通りです。
v20.11.0
v18.19.1

@7shironana
Copy link

↑の方に追記で
v20.11.1 でも発生します。

@16439s
Copy link

16439s commented Mar 11, 2024

I'm running Arch Linux and Node.js v21.6.2. npm run build fails with 36 errors.

Log:

[misskey@chaotic ai]$ npm run build

> build
> tspc

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

46  public connection: Stream;
           ~~~~~~~~~~

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

52  public lastSleepedAt: number;
           ~~~~~~~~~~~~~

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

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

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

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

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

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

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

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

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

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

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

365   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; mecab: string; mecabDic: string; memoryDir: 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; mecab: string; mecabDic: string; memoryDir: string; }'.

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

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

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

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

74  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:459:12 - error TS18046: 'res' is of type 'unknown'.

459     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 36 errors in 15 files.

Errors  Files
     8  src/ai.ts:46
       2  src/config.ts:22
       2  src/index.ts:68
       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

これはこういうエラーでてますが、ビルドは内部的にできてるらしいので、
npm run start で動くっぽい。
俺はわかんなかったので、追記しておく。

@7shironana
Copy link

7shironana commented Mar 11, 2024

こちらのIssueにある通り、本件は仕様とのことです。(遡っていて気づきました)
#129

類似のIssueを避けるためにもドキュメントへの記載を希望します。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants