Quiero usar el objeto de mapa en lugar de llamar a checkOrder 3 veces. ¿Cómo usar a través de Map en lugar de todos los parámetros en este caso? :
Admin.ts
class Admin{ async checkTest( local: string, suburb: string, international: string ): Promise<void> { await checkOrder(local, "Declined"); await checkOrder(suburb, "Declined"); await checkOrder(international, "Declined"); return; } }Prueba.ts
test("Test", async (t) => { await Admin.checkTest( "Local Place", "Suburb Place", "International Place" ); ); }@Thomas Quiero usar el objeto de mapa en lugar de llamar a checkOrder 3 veces.
¿como esto?
class Admin { async checkTest(map: Map<Place, Status>) { for (let [place, status] of map) { await checkOrder(place, status); } } }y
test("Test", async (t) => { await Admin.checkTest( new Map([ ["Local Place", "Declined"], ["Suburb Place", "Declined"], ["International Place", "Declined"], ]) ); });Entonces, ¿es correcto usar el mapa en mi caso?
class Admin { async checkTest(map: Map<string, string>) { for (let [place, status] of map) { await checkOrder(place, status); } } }y
test("Test", async (t) => { await Admin.checkTest( new Map([ ["Local Place", "Declined"], ["Suburb Place", "Declined"], ["International Place", "Declined"], ]) ); });