prescottprue/cypress-firebase

bug(types): error importing attachCustomCommands in typescript

josheverett opened this issue · 3 comments

Describe the bug

import { attachCustomCommands } from 'cypress-firebase'; fails with:

File /node_modules/cypress-firebase/index.d.ts' is not a module. ts(2306)

To Reproduce

  1. Install and configure cypress, verify you can run a hello world test.
  2. npm install --save-dev cypress-firebase firebase-admin
  3. Create cypress/support/commands.ts, following Setup guide from README:
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/database";
import "firebase/firestore";
import { attachCustomCommands } from "cypress-firebase";

const fbConfig = {
  // Your config from Firebase Console
};

firebase.initializeApp(fbConfig);

attachCustomCommands({ Cypress, cy, firebase });
  1. TypeScript surfaces the following error in VSCode: File <path>/node_modules/cypress-firebase/index.d.ts' is not a module. ts(2306)

  2. To troubleshoot, I npm installed another TypeScript-friendly zero-dependency module and imported it within cypress/support/commands.ts. It produced no errors as expected.

Expected behavior/code
TypeScript correctly recognizes this file and its types.

Additional Context/Screenshots

Screenshot:

Screen Shot 2021-10-05 at 13 34 19

I'm also running into this.

Same here - did anyone find a work around?

I had to just // @ts-ignore the import declaration.