I have an items
object with Item
s like this:
class Item {
/**
*@type {number}
*/
id;
}
let items = {};
I want to document the fact that keys of items
is value.id
is there a way ot do so?
Currently I'm using this syntax.
/**
* @type {{[item_id:number]:Item}}
*/
let items = {};
You can use Record
/**
* @type {Record<Item['id'], Item>}
*/
let items = {};