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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
=== tests/cases/conformance/classes/propertyMemberDeclarations/accessibilityModifiers.ts ===
// No errors
class C {
>C : C
private static privateProperty;
>privateProperty : any
private static privateMethod() { }
>privateMethod : () => void
private static get privateGetter() { return 0; }
>privateGetter : number
>0 : 0
private static set privateSetter(a: number) { }
>privateSetter : number
>a : number
protected static protectedProperty;
>protectedProperty : any
protected static protectedMethod() { }
>protectedMethod : () => void
protected static get protectedGetter() { return 0; }
>protectedGetter : number
>0 : 0
protected static set protectedSetter(a: number) { }
>protectedSetter : number
>a : number
public static publicProperty;
>publicProperty : any
public static publicMethod() { }
>publicMethod : () => void
public static get publicGetter() { return 0; }
>publicGetter : number
>0 : 0
public static set publicSetter(a: number) { }
>publicSetter : number
>a : number
}
// Errors, accessibility modifiers must precede static
class D {
>D : D
static private privateProperty;
>privateProperty : any
static private privateMethod() { }
>privateMethod : () => void
static private get privateGetter() { return 0; }
>privateGetter : number
>0 : 0
static private set privateSetter(a: number) { }
>privateSetter : number
>a : number
static protected protectedProperty;
>protectedProperty : any
static protected protectedMethod() { }
>protectedMethod : () => void
static protected get protectedGetter() { return 0; }
>protectedGetter : number
>0 : 0
static protected set protectedSetter(a: number) { }
>protectedSetter : number
>a : number
static public publicProperty;
>publicProperty : any
static public publicMethod() { }
>publicMethod : () => void
static public get publicGetter() { return 0; }
>publicGetter : number
>0 : 0
static public set publicSetter(a: number) { }
>publicSetter : number
>a : number
}
// Errors, multiple accessibility modifier
class E {
>E : E
private public protected property;
>property : any
public protected method() { }
>method : () => void
private protected get getter() { return 0; }
>getter : number
>0 : 0
public public set setter(a: number) { }
>setter : number
>a : number
}
|