Microsoft/TypeScript

Confusing error message for labels used before definition

開放

#30,408 建立於 2019年3月14日

 (16 則留言) (2 個反應) (0 位負責人)TypeScript (13,395 個分叉)batch import
Domain: Error MessagesEffort: ModerateExperience EnhancementGood First IssueHelp WantedSuggestion

倉庫指標

星標
 (108,860 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

The following gives me an unexpected "TS1007: Jump target cannot cross function boundary error" in TS 3.3.33333

function foo() {
    for (let i = 0; i < 10; i++) {
        console.log(`${i}`);
        continue loopend;
    }

    loopend:
    console.log('end of loop');
}

Further investigation... you can jump to the start of the loop, so the error I would argue is that the error message is confusing.

shareable link

貢獻者指南