You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(1,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
2
-
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(8,1): error TS7043: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'c.get' ?
3
-
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(14,1): error TS7043: Element implicitly has an 'any' type because type '{ set: (key: string) => string; }' has no index signature. Did you mean to call 'd.set' ?
4
-
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(21,1): error TS7043: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.get or e.set' ?
2
+
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(7,1): error TS7051: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'c.get'?
3
+
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(8,13): error TS7051: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'c.get'?
4
+
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(13,13): error TS7017: Element implicitly has an 'any' type because type '{ set: (key: string) => string; }' has no index signature.
5
+
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(19,1): error TS7051: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.set'?
6
+
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(20,1): error TS7051: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.set'?
7
+
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(21,1): error TS7051: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.set'?
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
11
14
var b: string = { '': 'foo' }[''];
12
15
13
-
// Should give suggestion 'c.get'
14
16
var c = {
15
17
get: (key: string) => 'foobar'
16
18
};
17
19
c['hello'];
18
20
~~~~~~~~~~
19
-
!!! error TS7043: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'c.get' ?
21
+
!!! error TS7051: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'c.get'?
22
+
const foo = c['hello'];
23
+
~~~~~~~~~~
24
+
!!! error TS7051: Element implicitly has an 'any' type because type '{ get: (key: string) => string; }' has no index signature. Did you mean to call 'c.get'?
20
25
21
-
// Should give suggestion 'd.set'
22
26
var d = {
23
27
set: (key: string) => 'foobar'
24
28
};
25
-
d['hello'];
26
-
~~~~~~~~~~
27
-
!!! error TS7043: Element implicitly has an 'any' type because type '{ set: (key: string) => string; }' has no index signature. Did you mean to call 'd.set' ?
29
+
const bar = d['hello'];
30
+
~~~~~~~~~~
31
+
!!! error TS7017: Element implicitly has an 'any' type because type '{ set: (key: string) => string; }' has no index signature.
28
32
29
-
// Should give suggestion 'e.get or e.set'
30
33
var e = {
31
34
set: (key: string) => 'foobar',
32
35
get: (key: string) => 'foobar'
33
36
};
34
-
e['hello'];
37
+
e['hello'] = 'modified';
38
+
~~~~~~~~~~
39
+
!!! error TS7051: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.set'?
40
+
e['hello'] += 1;
35
41
~~~~~~~~~~
36
-
!!! error TS7043: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.get or e.set' ?
42
+
!!! error TS7051: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.set'?
43
+
e['hello'] ++;
44
+
~~~~~~~~~~
45
+
!!! error TS7051: Element implicitly has an 'any' type because type '{ set: (key: string) => string; get: (key: string) => string; }' has no index signature. Did you mean to call 'e.set'?
0 commit comments