File: indexSignatureTypeCheck.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 (33 lines) | stat: -rw-r--r-- 1,252 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
tests/cases/compiler/indexSignatureTypeCheck.ts(14,8): error TS1019: An index signature parameter cannot have a question mark.
tests/cases/compiler/indexSignatureTypeCheck.ts(15,6): error TS1017: An index signature cannot have a rest parameter.
tests/cases/compiler/indexSignatureTypeCheck.ts(16,6): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/indexSignatureTypeCheck.ts(17,6): error TS1096: An index signature must have exactly one parameter.


==== tests/cases/compiler/indexSignatureTypeCheck.ts (4 errors) ====
    interface IPropertySet {
    
        [index: string]: any;
    
    }
    
    
    var ps: IPropertySet = null;
    var index: any = "hello";
    ps[index] = 12;
    
    
    interface indexErrors {
        [p2?: string];
           ~
!!! error TS1019: An index signature parameter cannot have a question mark.
        [...p3: any[]];
         ~~~
!!! error TS1017: An index signature cannot have a rest parameter.
        [p4: string, p5?: string];
         ~~
!!! error TS1096: An index signature must have exactly one parameter.
        [p6: string, ...p7: any[]];
         ~~
!!! error TS1096: An index signature must have exactly one parameter.
    }