File: typeFromPrototypeAssignment3.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (25 lines) | stat: -rw-r--r-- 957 bytes parent folder | download | duplicates (4)
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
tests/cases/conformance/salsa/bug26885.js(11,16): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
  No index signature with a parameter of type 'string' was found on type '{}'.


==== tests/cases/conformance/salsa/bug26885.js (1 errors) ====
    function Multimap3() {
        this._map = {};
    };
    
    Multimap3.prototype = {
        /**
         * @param {string} key
         * @returns {number} the value ok
         */
        get(key) {
            return this._map[key + ''];
                   ~~~~~~~~~~~~~~~~~~~
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
!!! error TS7053:   No index signature with a parameter of type 'string' was found on type '{}'.
        }
    }
    
    /** @type {Multimap3} */
    const map = new Multimap3();
    const n = map.get('hi')