File: emitClassExpressionInDeclarationFile2.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (44 lines) | stat: -rw-r--r-- 1,984 bytes parent folder | download | duplicates (3)
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
tests/cases/compiler/emitClassExpressionInDeclarationFile2.ts(1,12): error TS4094: Property 'p' of exported class expression may not be private or protected.
tests/cases/compiler/emitClassExpressionInDeclarationFile2.ts(1,12): error TS4094: Property 'ps' of exported class expression may not be private or protected.
tests/cases/compiler/emitClassExpressionInDeclarationFile2.ts(16,17): error TS4094: Property 'property' of exported class expression may not be private or protected.
tests/cases/compiler/emitClassExpressionInDeclarationFile2.ts(23,14): error TS4094: Property 'property' of exported class expression may not be private or protected.


==== tests/cases/compiler/emitClassExpressionInDeclarationFile2.ts (4 errors) ====
    export var noPrivates = class {
               ~~~~~~~~~~
!!! error TS4094: Property 'p' of exported class expression may not be private or protected.
               ~~~~~~~~~~
!!! error TS4094: Property 'ps' of exported class expression may not be private or protected.
        static getTags() { }
        tags() { }
        private static ps = -1
        private p = 12
    }
    
    // altered repro from #15066 to add private property
    export class FooItem {
        foo(): void { }
        name?: string;
        private property = "capitalism"
    }
    
    export type Constructor<T> = new(...args: any[]) => T;
    export function WithTags<T extends Constructor<FooItem>>(Base: T) {
                    ~~~~~~~~
!!! error TS4094: Property 'property' of exported class expression may not be private or protected.
        return class extends Base {
            static getTags(): void { }
            tags(): void { }
        }
    }
    
    export class Test extends WithTags(FooItem) {}
                 ~~~~
!!! error TS4094: Property 'property' of exported class expression may not be private or protected.
    
    const test = new Test();
    
    Test.getTags()
    test.tags();