Actually, I probably want to generate some code for my client based on my Rescript function files.
On the server side I have something like:
let createOrder: Firebase.Functions.callableFunction<
Domain.createOrderRequest,
string,
> = Firebase.Functions.Https.onCall(
~opts={
region: Domain.firebaseRegion,
allowedCors: Common.allowedCors,
},
~handler=request => {
let requestData: createOrderRequest = request.data
Console.log(requestData)
Promise.resolve("https://nojaf.com")
},
)
If I can somehow process all files and detect any let binding that has type callableFunction and generate my client side API.
Something like:
let createOrder: Firebase.Functions.httpsCallable<
Domain.createOrderRequest,
string,
> = Functions.httpsCallable(functions, ~name="createOrder")
if I can generate this, it will always match my server code.
Is there any way to get the ReScript (typed) AST?