|
1 |
| -==== tests/cases/conformance/types/members/duplicateStringIndexers.ts (52 errors) ==== |
| 1 | +==== tests/cases/conformance/types/members/duplicateStringIndexers.ts (6 errors) ==== |
2 | 2 | // it is an error to have duplicate index signatures of the same kind in a type
|
3 | 3 |
|
4 |
| - interface Number { |
5 |
| - [x: string]: string; |
6 |
| - ~~~~~~~~~~~~~~~~~~~~ |
7 |
| -!!! Property 'toExponential' of type '(fractionDigits?: number) => string' is not assignable to string index type 'string'. |
8 |
| - ~~~~~~~~~~~~~~~~~~~~ |
9 |
| -!!! Property 'toFixed' of type '(fractionDigits?: number) => string' is not assignable to string index type 'string'. |
10 |
| - ~~~~~~~~~~~~~~~~~~~~ |
11 |
| -!!! Property 'toPrecision' of type '(precision?: number) => string' is not assignable to string index type 'string'. |
12 |
| - ~~~~~~~~~~~~~~~~~~~~ |
13 |
| -!!! Property 'toString' of type '(radix?: number) => string' is not assignable to string index type 'string'. |
14 |
| - [x: string]: string; |
15 |
| - ~~~~~~~~~~~~~~~~~~~~ |
| 4 | + module test { |
| 5 | + interface Number { |
| 6 | + [x: string]: string; |
| 7 | + [x: string]: string; |
| 8 | + ~~~~~~~~~~~~~~~~~~~~ |
16 | 9 | !!! Duplicate string index signature.
|
17 |
| - } |
| 10 | + } |
18 | 11 |
|
19 |
| - interface String { |
20 |
| - [x: string]: string; |
21 |
| - ~~~~~~~~~~~~~~~~~~~~ |
22 |
| -!!! Property 'charAt' of type '(pos: number) => string' is not assignable to string index type 'string'. |
23 |
| - ~~~~~~~~~~~~~~~~~~~~ |
24 |
| -!!! Property 'charCodeAt' of type '(index: number) => number' is not assignable to string index type 'string'. |
25 |
| - ~~~~~~~~~~~~~~~~~~~~ |
26 |
| -!!! Property 'concat' of type '(...strings: string[]) => string' is not assignable to string index type 'string'. |
27 |
| - ~~~~~~~~~~~~~~~~~~~~ |
28 |
| -!!! Property 'indexOf' of type '(searchString: string, position?: number) => number' is not assignable to string index type 'string'. |
29 |
| - ~~~~~~~~~~~~~~~~~~~~ |
30 |
| -!!! Property 'lastIndexOf' of type '(searchString: string, position?: number) => number' is not assignable to string index type 'string'. |
31 |
| - ~~~~~~~~~~~~~~~~~~~~ |
32 |
| -!!! Property 'length' of type 'number' is not assignable to string index type 'string'. |
33 |
| - ~~~~~~~~~~~~~~~~~~~~ |
34 |
| -!!! Property 'localeCompare' of type '(that: string) => number' is not assignable to string index type 'string'. |
35 |
| - ~~~~~~~~~~~~~~~~~~~~ |
36 |
| -!!! Property 'match' of type '{ (regexp: string): string[]; (regexp: RegExp): string[]; }' is not assignable to string index type 'string'. |
37 |
| - ~~~~~~~~~~~~~~~~~~~~ |
38 |
| -!!! Property 'replace' of type '{ (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; }' is not assignable to string index type 'string'. |
39 |
| - ~~~~~~~~~~~~~~~~~~~~ |
40 |
| -!!! Property 'search' of type '{ (regexp: string): number; (regexp: RegExp): number; }' is not assignable to string index type 'string'. |
41 |
| - ~~~~~~~~~~~~~~~~~~~~ |
42 |
| -!!! Property 'slice' of type '(start?: number, end?: number) => string' is not assignable to string index type 'string'. |
43 |
| - ~~~~~~~~~~~~~~~~~~~~ |
44 |
| -!!! Property 'split' of type '{ (separator: string, limit?: number): string[]; (separator: RegExp, limit?: number): string[]; }' is not assignable to string index type 'string'. |
45 |
| - ~~~~~~~~~~~~~~~~~~~~ |
46 |
| -!!! Property 'substr' of type '(from: number, length?: number) => string' is not assignable to string index type 'string'. |
47 |
| - ~~~~~~~~~~~~~~~~~~~~ |
48 |
| -!!! Property 'substring' of type '(start: number, end?: number) => string' is not assignable to string index type 'string'. |
49 |
| - ~~~~~~~~~~~~~~~~~~~~ |
50 |
| -!!! Property 'toLocaleLowerCase' of type '() => string' is not assignable to string index type 'string'. |
51 |
| - ~~~~~~~~~~~~~~~~~~~~ |
52 |
| -!!! Property 'toLocaleUpperCase' of type '() => string' is not assignable to string index type 'string'. |
53 |
| - ~~~~~~~~~~~~~~~~~~~~ |
54 |
| -!!! Property 'toLowerCase' of type '() => string' is not assignable to string index type 'string'. |
55 |
| - ~~~~~~~~~~~~~~~~~~~~ |
56 |
| -!!! Property 'toString' of type '() => string' is not assignable to string index type 'string'. |
57 |
| - ~~~~~~~~~~~~~~~~~~~~ |
58 |
| -!!! Property 'toUpperCase' of type '() => string' is not assignable to string index type 'string'. |
59 |
| - ~~~~~~~~~~~~~~~~~~~~ |
60 |
| -!!! Property 'trim' of type '() => string' is not assignable to string index type 'string'. |
61 |
| - [x: string]: string; |
62 |
| - ~~~~~~~~~~~~~~~~~~~~ |
| 12 | + interface String { |
| 13 | + [x: string]: string; |
| 14 | + [x: string]: string; |
| 15 | + ~~~~~~~~~~~~~~~~~~~~ |
63 | 16 | !!! Duplicate string index signature.
|
64 |
| - } |
| 17 | + } |
65 | 18 |
|
66 |
| - interface Array<T> { |
67 |
| - [x: string]: T; |
68 |
| - ~~~~~~~~~~~~~~~ |
69 |
| -!!! Property 'concat' of type '{ <U extends T[]>(...items: U[]): T[]; (...items: T[]): T[]; }' is not assignable to string index type 'T'. |
70 |
| - ~~~~~~~~~~~~~~~ |
71 |
| -!!! Property 'every' of type '(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => boolean' is not assignable to string index type 'T'. |
72 |
| - ~~~~~~~~~~~~~~~ |
73 |
| -!!! Property 'filter' of type '(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => T[]' is not assignable to string index type 'T'. |
74 |
| - ~~~~~~~~~~~~~~~ |
75 |
| -!!! Property 'forEach' of type '(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any) => void' is not assignable to string index type 'T'. |
76 |
| - ~~~~~~~~~~~~~~~ |
77 |
| -!!! Property 'indexOf' of type '(searchElement: T, fromIndex?: number) => number' is not assignable to string index type 'T'. |
78 |
| - ~~~~~~~~~~~~~~~ |
79 |
| -!!! Property 'join' of type '(separator?: string) => string' is not assignable to string index type 'T'. |
80 |
| - ~~~~~~~~~~~~~~~ |
81 |
| -!!! Property 'lastIndexOf' of type '(searchElement: T, fromIndex?: number) => number' is not assignable to string index type 'T'. |
82 |
| - ~~~~~~~~~~~~~~~ |
83 |
| -!!! Property 'length' of type 'number' is not assignable to string index type 'T'. |
84 |
| - ~~~~~~~~~~~~~~~ |
85 |
| -!!! Property 'map' of type '<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[]' is not assignable to string index type 'T'. |
86 |
| - ~~~~~~~~~~~~~~~ |
87 |
| -!!! Property 'pop' of type '() => T' is not assignable to string index type 'T'. |
88 |
| - ~~~~~~~~~~~~~~~ |
89 |
| -!!! Property 'push' of type '(...items: T[]) => number' is not assignable to string index type 'T'. |
90 |
| - ~~~~~~~~~~~~~~~ |
91 |
| -!!! Property 'reduce' of type '{ (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; <U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }' is not assignable to string index type 'T'. |
92 |
| - ~~~~~~~~~~~~~~~ |
93 |
| -!!! Property 'reduceRight' of type '{ (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; <U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }' is not assignable to string index type 'T'. |
94 |
| - ~~~~~~~~~~~~~~~ |
95 |
| -!!! Property 'reverse' of type '() => T[]' is not assignable to string index type 'T'. |
96 |
| - ~~~~~~~~~~~~~~~ |
97 |
| -!!! Property 'shift' of type '() => T' is not assignable to string index type 'T'. |
98 |
| - ~~~~~~~~~~~~~~~ |
99 |
| -!!! Property 'slice' of type '(start?: number, end?: number) => T[]' is not assignable to string index type 'T'. |
100 |
| - ~~~~~~~~~~~~~~~ |
101 |
| -!!! Property 'some' of type '(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => boolean' is not assignable to string index type 'T'. |
102 |
| - ~~~~~~~~~~~~~~~ |
103 |
| -!!! Property 'sort' of type '(compareFn?: (a: T, b: T) => number) => T[]' is not assignable to string index type 'T'. |
104 |
| - ~~~~~~~~~~~~~~~ |
105 |
| -!!! Property 'splice' of type '{ (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; }' is not assignable to string index type 'T'. |
106 |
| - ~~~~~~~~~~~~~~~ |
107 |
| -!!! Property 'toLocaleString' of type '() => string' is not assignable to string index type 'T'. |
108 |
| - ~~~~~~~~~~~~~~~ |
109 |
| -!!! Property 'toString' of type '() => string' is not assignable to string index type 'T'. |
110 |
| - ~~~~~~~~~~~~~~~ |
111 |
| -!!! Property 'unshift' of type '(...items: T[]) => number' is not assignable to string index type 'T'. |
112 |
| - [x: string]: T; |
113 |
| - ~~~~~~~~~~~~~~~ |
| 19 | + interface Array<T> { |
| 20 | + [x: string]: T; |
| 21 | + [x: string]: T; |
| 22 | + ~~~~~~~~~~~~~~~ |
114 | 23 | !!! Duplicate string index signature.
|
115 |
| - } |
| 24 | + } |
116 | 25 |
|
117 |
| - class C { |
118 |
| - [x: string]: string; |
119 |
| - [x: string]: string; |
120 |
| - ~~~~~~~~~~~~~~~~~~~~ |
| 26 | + class C { |
| 27 | + [x: string]: string; |
| 28 | + [x: string]: string; |
| 29 | + ~~~~~~~~~~~~~~~~~~~~ |
121 | 30 | !!! Duplicate string index signature.
|
122 |
| - } |
| 31 | + } |
123 | 32 |
|
124 |
| - interface I { |
125 |
| - [x: string]: string; |
126 |
| - [x: string]: string; |
127 |
| - ~~~~~~~~~~~~~~~~~~~~ |
| 33 | + interface I { |
| 34 | + [x: string]: string; |
| 35 | + [x: string]: string; |
| 36 | + ~~~~~~~~~~~~~~~~~~~~ |
128 | 37 | !!! Duplicate string index signature.
|
129 |
| - } |
| 38 | + } |
130 | 39 |
|
131 |
| - var a: { |
132 |
| - [x: string]: string; |
133 |
| - [x: string]: string; |
134 |
| - ~~~~~~~~~~~~~~~~~~~~ |
| 40 | + var a: { |
| 41 | + [x: string]: string; |
| 42 | + [x: string]: string; |
| 43 | + ~~~~~~~~~~~~~~~~~~~~ |
135 | 44 | !!! Duplicate string index signature.
|
| 45 | + } |
136 | 46 | }
|
137 |
| - |
138 | 47 |
|
0 commit comments