Dev Helpers
← Back

Transform a promised record

Transform a promised record using TypeScript.

Open this example in the interactive library

Source code

const load = async (id: number): Promise<{ id: number; ready: boolean }> => ({
  id,
  ready: true,
});
console.log(await load(2).then(({ id }): string => "job-" + id));

Sample output

job-2