File: topLevelAwait.1%28module%3Dsystem%2Ctarget%3Des2015%29.errors.txt

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (79 lines) | stat: -rw-r--r-- 2,293 bytes parent folder | download | duplicates (2)
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
72
73
74
75
76
77
78
79
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.


==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
    export const x = 1;
    await x;
    ~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.
    
    // reparse element access as await
    await [x];
    await [x, x];
    
    // reparse call as await
    declare function f(): number;
    await (x);
    await (f(), x);
    await <number>(x);
    await <number>(f(), x);
    
    // reparse tagged template as await
    await ``;
    await <string> ``;
    
    // member names should be ok
    class C1 {
        await() {}
    }
    class C2 {
        get await() { return 1; }
        set await(value) { }
    }
    class C3 {
        await = 1;
    }
    ({
        await() {}
    });
    ({
        get await() { return 1 },
        set await(value) { }
    });
    ({
        await: 1
    });
    
    // property access name should be ok
    C1.prototype.await;
    
    // await in decorators
    declare const dec: any;
    @(await dec)
      ~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.
    class C {
    }
    
    // await allowed in aliased import
    import { await as _await } from "./other";
    
    // newlines
    // await in throw
    throw await
        1;
    
    // await in var
    let y = await
        1;
    
    // await in expression statement;
    await
        1;
    
==== tests/cases/conformance/externalModules/other.ts (0 errors) ====
    const _await = 1;
    
    // await allowed in aliased export
    export { _await as await };