TypeScript error TS1005: ';' expected (II)

后端 未结 9 1077
旧巷少年郎
旧巷少年郎 2020-12-09 02:11

First of all, I\'ve already seen the other posts about error TS1005. Same error code, but totally different.

A simple let x: number; will gener

9条回答
  •  温柔的废话
    2020-12-09 02:48

    The issue was in my code.

    In large code base, issue was not clear.

    A simplified code is below:

    Bad:

     collection.insertMany(
        [[],
        function (err, result) {
        });
    

    Good:

    collection.insertMany(
        [],
        function (err, result) {
        });
    

    That is, the first one has [[], instead of normal array []

    TS error was not clear enough, and it showed error in the last line with });

    Hope this helps.

提交回复
热议问题