File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ display : " Permetti Codice Irraggiungibile"
3+ oneline : " Visualizza un errore quando il codice non verrà mai eseguito"
4+ ---
5+
6+ Quando:
7+
8+ - ` undefined ` (predefinito) fornire suggerimenti come avviso agli editor
9+ - ` true ` il codice irraggiungibile viene ignorato
10+ - ` false ` visualizza un errore di compilazione quando viene trovato del codice irraggiungibile
11+
12+ Questi avvertimenti sono solo per codice che probabilmente è irraggiungibile a causa del uso di sintassi JavaScript, per esempio:
13+
14+ ``` ts
15+ function fn(n : number ) {
16+ if (n > 5 ) {
17+ return true ;
18+ } else {
19+ return false ;
20+ }
21+ return true ;
22+ }
23+ ```
24+
25+ Con ` "allowUnreachableCode": false ` :
26+
27+ ``` ts twoslash
28+ // @errors: 7027
29+ // @allowUnreachableCode: false
30+ function fn(n : number ) {
31+ if (n > 5 ) {
32+ return true ;
33+ } else {
34+ return false ;
35+ }
36+ return true ;
37+ }
38+ ```
39+
40+ Ciò non influisce sugli errori sulla base del codice che _ sembra_ di essere irraggiungibile a causa dell analisi del tipo.
You can’t perform that action at this time.
0 commit comments