How do I translate this TypeScript to ReScript

How do I translate this TypeScript types to ReScript

type RequestMap = {
  "/addresses": Address[]
  "/people": Person[]
}

type URI = keyof RequestMap

declare function get<T extends URI>(uri: T): Promise<RequestMap[T]>

Not sure you’d be able to map this 1:1 how you’d expect in Rescript, since TS allows you to extract keys out as a union type. Rescript is a little more strict about that

If you’re interested in defining routes in one place as url -> model, you can get the same kind of ergonomics composing a couple utility functions

// -- route util

external fetch: string => promise<'a> = "get"

let get = async (url, decoder, ()) => {
  let res = await fetch(url)
  decoder(res)
}

// --- models

type address = {}
type person = {}

external decodeAddresses: Js.Json.t => array<address> = "%identity"
external decodePeople: Js.Json.t => array<person> = "%identity"

// --- requests

module Get = {
	let addresses = get("/address", decodeAddresses)
	let people = get("/people", decodePeople)
}

// -- usage

let main = async () => {
	let _res = await Get.addresses()
}

Playground Link

Oh I see. Yeah that’s fine, I just need to know how to do that (albeit with a different approach) in ReScript.