/
noImplicitAnyStringIndexerOnObject.errors.txt
47 lines (40 loc) · 3.27 KB
/
noImplicitAnyStringIndexerOnObject.errors.txt
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
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(1,9): error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(7,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'?
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(8,13): 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'?
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.
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(19,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.set'?
tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts(20,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.set'?
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.set'?
==== tests/cases/compiler/noImplicitAnyStringIndexerOnObject.ts (7 errors) ====
var a = {}["hello"];
~~~~~~~~~~~
!!! error TS7017: Element implicitly has an 'any' type because type '{}' has no index signature.
var b: string = { '': 'foo' }[''];
var c = {
get: (key: string) => 'foobar'
};
c['hello'];
~~~~~~~~~~
!!! 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'?
const foo = c['hello'];
~~~~~~~~~~
!!! 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'?
var d = {
set: (key: string) => 'foobar'
};
const bar = d['hello'];
~~~~~~~~~~
!!! error TS7017: Element implicitly has an 'any' type because type '{ set: (key: string) => string; }' has no index signature.
var e = {
set: (key: string) => 'foobar',
get: (key: string) => 'foobar'
};
e['hello'] = 'modified';
~~~~~~~~~~
!!! 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.set'?
e['hello'] += 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.set'?
e['hello'] ++;
~~~~~~~~~~
!!! 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.set'?