File: reachabilityChecks7.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (71 lines) | stat: -rw-r--r-- 1,924 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//// [reachabilityChecks7.ts]
// async function without return type annotation - error
async function f1() {    
}

let x = async function() {
}

// async function with which promised type is void - return can be omitted
async function f2(): Promise<void> {
    
}

async function f3(x) {
    if (x) return 10;
}

async function f4(): Promise<number> {
    
}

function voidFunc(): void {
}

function calltoVoidFunc(x) {
    if (x) return voidFunc();
}

declare function use(s: string): void;
let x1 = () => { use("Test"); }

//// [reachabilityChecks7.js]
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
// async function without return type annotation - error
function f1() {
    return __awaiter(this, void 0, void 0, function* () {
    });
}
let x = function () {
    return __awaiter(this, void 0, void 0, function* () {
    });
};
// async function with which promised type is void - return can be omitted
function f2() {
    return __awaiter(this, void 0, void 0, function* () {
    });
}
function f3(x) {
    return __awaiter(this, void 0, void 0, function* () {
        if (x)
            return 10;
    });
}
function f4() {
    return __awaiter(this, void 0, void 0, function* () {
    });
}
function voidFunc() {
}
function calltoVoidFunc(x) {
    if (x)
        return voidFunc();
}
let x1 = () => { use("Test"); };