Consider this file which makes bindings to Firebase. The generated .bs.js file doesn’t work; it references a function getFirestore that isn’t imported from anywhere. And Firestore.make isn’t exported. I have a decent amount of experience with genType but maybe I’m doing something wrong.
I don’t think so. This is the simplest repro scenario I could come up with for a problem in the app I’m building. If you put a gentype annotation on the makeWithLogging function it still don’t work. ReScript doesn’t know if I’ve imported this function somewhere in my TypeScript code. I will try again later - just using my phone now - to see if you’re right about this.
=== UPDATED ===
Just got on my computer and tried some things. I think the gen.tsx files look ok. But when I follow the import trail they import from bs.js files that are broken; they reference a function getFirestore that isn’t imported from anywhere. For example, one of my gen.tsx files references a bs.js file like this.
// Generated by ReScript, PLEASE EDIT WITH CARE
import * as Firebase3 from "./Firebase3.bs.js";
function n(param) {
return getFirestore(Firebase3.FirebaseApp.make(undefined));
}
export {
n ,
}
/* Firebase3 Not a pure module */
I’m pretty sure something is broken about genType right now. I created a new project using the ReScript template. I added a couple bindings for Firebase and the code doesn’t look like it will work.
If you look at UseFirebase.ts you see it imports from ./FirebaseBindings.gen.
In FirebaseBindings.gen you’ll see a require... which I don’t understand since I configured it for es6. Why is there the require syntax?
In FirebaseBindings.bs you’ll see a call to getFirestore which SHOULD BE a call to FirebaseBindingsGen.getFirestore. This call will never work and in my real app I was getting a runtime error about that function not existing.