File: exponentiationOperatorWithTypeParameter.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 (42 lines) | stat: -rw-r--r-- 1,027 bytes parent folder | download | duplicates (7)
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
//// [exponentiationOperatorWithTypeParameter.ts]
// type parameter type is not valid for arithmetic operand
function foo<T>(t: T) {
    var a: any;
    var b: boolean;
    var c: number;
    var d: string;
    var e: {};

    var r1a1 = a ** t;
    var r2a1 = t ** a;
    var r1b1 = b ** t;
    var r2b1 = t ** b;
    var r1c1 = c ** t;
    var r2c1 = t ** c;
    var r1d1 = d ** t;
    var r2d1 = t ** d;
    var r1e1 = e ** t;
    var r2e1 = t ** d;
    var r1f1 = t ** t;
}

//// [exponentiationOperatorWithTypeParameter.js]
// type parameter type is not valid for arithmetic operand
function foo(t) {
    var a;
    var b;
    var c;
    var d;
    var e;
    var r1a1 = Math.pow(a, t);
    var r2a1 = Math.pow(t, a);
    var r1b1 = Math.pow(b, t);
    var r2b1 = Math.pow(t, b);
    var r1c1 = Math.pow(c, t);
    var r2c1 = Math.pow(t, c);
    var r1d1 = Math.pow(d, t);
    var r2d1 = Math.pow(t, d);
    var r1e1 = Math.pow(e, t);
    var r2e1 = Math.pow(t, d);
    var r1f1 = Math.pow(t, t);
}