0

I'm writing Firebase cloud functions in a dart/flutter environment using TypeScript. (I think I'm using TS--I just renamed index.js to index.ts and change package.json line to "main"; "index.ts")

I can deploy my functions fine and they work great but am getting the warnings below for require and export.

enter image description here

There's a relevant conversation here but couldn't find an option that worked, so resorted to the hacky declare var require: any which shut off the warnings but Firebase didn't like it?

enter image description here

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
buttonsrtoys
  • 2,359
  • 3
  • 32
  • 52
  • 1
    If you want to use TypeScript with Cloud Functions using the Firebase CLI, you should consider just running `firebase init` all over again and letting the tool configure your project correctly for TypeScript. It's not enough to just rename files from js to ts. – Doug Stevenson Oct 20 '20 at 15:20
  • Thanks, Doug. Do I run that from within the `functions` folder? – buttonsrtoys Oct 20 '20 at 16:50
  • 1
    [Documentation](https://firebase.google.com/docs/cli#initialize_a_firebase_project) indicates that one should run the firebase init command from within the concerned app's directory. – George Oct 21 '20 at 13:54
  • Above comments saved the day. I deleted by old `functions` folder and ran `firebase init` from my project root and it created a new `functions` folder and all the necessary files – buttonsrtoys Oct 27 '20 at 13:43

0 Answers0