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
|
=== tests/cases/conformance/constEnums/constEnum2.ts ===
// An enum declaration that specifies a const modifier is a constant enum declaration.
// In a constant enum declaration, all members must have constant values and
// it is an error for a member declaration to specify an expression that isn't classified as a constant enum expression.
// Error : not a constant enum expression
const CONST = 9000 % 2;
>CONST : number
>9000 % 2 : number
>9000 : 9000
>2 : 2
const enum D {
>D : D
d = 10,
>d : D
>10 : 10
e = 199 * Math.floor(Math.random() * 1000),
>e : D
>199 * Math.floor(Math.random() * 1000) : number
>199 : 199
>Math.floor(Math.random() * 1000) : number
>Math.floor : (x: number) => number
>Math : Math
>floor : (x: number) => number
>Math.random() * 1000 : number
>Math.random() : number
>Math.random : () => number
>Math : Math
>random : () => number
>1000 : 1000
f = d - (100 * Math.floor(Math.random() % 8))
>f : D
>d - (100 * Math.floor(Math.random() % 8)) : number
>d : D
>(100 * Math.floor(Math.random() % 8)) : number
>100 * Math.floor(Math.random() % 8) : number
>100 : 100
>Math.floor(Math.random() % 8) : number
>Math.floor : (x: number) => number
>Math : Math
>floor : (x: number) => number
>Math.random() % 8 : number
>Math.random() : number
>Math.random : () => number
>Math : Math
>random : () => number
>8 : 8
g = CONST,
>g : D
>CONST : number
}
|