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')
|