Skip to content

[Blocking] Generated .bs.js code references a function that was not imported #6018

Closed
@jmagaram

Description

@jmagaram

=== UPDATED ===

See this playground

I can't run my project because code I import into TypeScript doesn't work.

=== UPDATED ===

The generated code does not work; some kind of import problem, maybe related to genType. There is a much simpler repro scenario in https://github.com/jmagaram/rescript-issues

Look at Firebase2Consumer.bs.js - notice the call to getFirestore, a function that is not imported.
Look at Firebase2.bs.js - notice the call to getFirestore, a function that should appear as Firebase2Gen.getFirestore

Adding a .resi file seems to fix it.

=== ORIGINAL POST ===
I'm writing some bindings for Firebase. The generated code does not run because of problems with imports/exports. rescript": "^10.1.2" I created a vite Rescript app and added 2 files.

https://github.com/jmagaram/rescript-issues

Look at the code generated in UseFirebase.bs.js. Notice the getFirestore function; it is not imported from anywhere. It should have been exported from Firebase.bs.js but is not. As I look closer at Firebase.bs.js I see tons of problems. It references functions like connectFirestoreEmulator but SHOULD reference FirebaseGen.connectFirestoreEmulator. Is this a genType issue?

// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Firebase from "./Firebase.bs.js";

var liveOptions = {
  apiKey: "AIzaSeDzEyIOOVDG4IMWnwlUgvuYSXOCk_ZGaOg",
  authDomain: "admin-panel.firebaseapp.com",
  projectId: "admin-panel",
  storageBucket: "admin-panel.appspot.com",
  messagingSenderId: "845699356146",
  appId: "1:845699356146:web:a28bc650144ac4a9e2876b",
  measurementId: "G-L87PBG6ZXD"
};

var app = Firebase.FirebaseApp.make(liveOptions);

var store = getFirestore(app);

export {
  liveOptions ,
  app ,
  store ,
}
/* app Not a pure module */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions