Skip to content

It is not possible compile to typescript #247

Open
@wazzu3000

Description

Version info

firebase-functions-test: 3.3.0

firebase-functions: 6.1.1

firebase-admin: 12.1.0

typescript: 4.9.0

Test case

At try to run any typescript compilation; I share with you a tiny example from my unit test code

My test script with Mocha

import firebaseFunctionsTest from 'firebase-functions-test';

describe('onCreateUser', () => {

  before(() => {
    firebaseFunctionsTest();
  });

  it('Hello world', async () => {
    // Test stuff
  });
});

tsconfig.json file

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "esModuleInterop": true,
    "target": "es2017",
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}

Steps to reproduce

  1. Create some test script using typescript
  2. run tsc

Expected behavior

The compilation should finish without errors

Actual behavior

The tsc returns the follow error messages, as you can see all of them are from firebase-functions-test definition files.

node_modules/firebase-functions-test/lib/main.d.ts:1:44 - error TS2305: Module '"firebase-functions"' has no exported member 'HttpsFunction'.

1 import { CloudFunction as CloudFunctionV1, HttpsFunction, Runnable } from 'firebase-functions';
                                             ~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/main.d.ts:1:59 - error TS2305: Module '"firebase-functions"' has no exported member 'Runnable'.   

1 import { CloudFunction as CloudFunctionV1, HttpsFunction, Runnable } from 'firebase-functions';
                                                            ~~~~~~~~

node_modules/firebase-functions-test/lib/main.d.ts:10:64 - error TS2344: Type 'T' does not satisfy the constraint 'CloudEvent<unknown>'.   

10 export declare function wrap<T>(cloudFunction: CloudFunctionV1<T>): WrappedScheduledFunction | WrappedFunction<T>;
                                                                  ~

  node_modules/firebase-functions-test/lib/main.d.ts:10:30
    10 export declare function wrap<T>(cloudFunction: CloudFunctionV1<T>): WrappedScheduledFunction | WrappedFunction<T>;
                                    ~
    This type parameter might need an `extends CloudEvent<unknown>` constraint.

node_modules/firebase-functions-test/lib/providers/analytics.d.ts:1:10 - error TS2305: Module '"firebase-functions"' has no exported member 'analytics'.

1 import { analytics } from 'firebase-functions';
           ~~~~~~~~~

node_modules/firebase-functions-test/lib/providers/auth.d.ts:1:10 - error TS2305: Module '"firebase-functions"' has no exported member 'auth'.

1 import { auth } from 'firebase-functions';
           ~~~~

node_modules/firebase-functions-test/lib/providers/pubsub.d.ts:11:5 - error TS2314: Generic type 'Message<T>' requires 1 type argument(s). 

11 }): pubsub.Message;
       ~~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/providers/pubsub.d.ts:19:5 - error TS2314: Generic type 'Message<T>' requires 1 type argument(s). 

19 }): pubsub.Message;
       ~~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/providers/pubsub.d.ts:21:43 - error TS2314: Generic type 'Message<T>' requires 1 type argument(s).

21 export declare function exampleMessage(): pubsub.Message;
                                             ~~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/providers/storage.d.ts:7:13 - error TS2694: Namespace '"C:/Users/RaulMendoza/Documents/JS/gasto-smart/functions/node_modules/firebase-functions/lib/v2/providers/storage"' has no exported member 'ObjectMetadata'.

7 }): storage.ObjectMetadata;
              ~~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/providers/storage.d.ts:9:58 - error TS2694: Namespace '"C:/Users/RaulMendoza/Documents/JS/gasto-smart/functions/node_modules/firebase-functions/lib/v2/providers/storage"' has no exported member 'ObjectMetadata'.

9 export declare function exampleObjectMetadata(): storage.ObjectMetadata;
                                                           ~~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/v1.d.ts:1:25 - error TS2305: Module '"firebase-functions"' has no exported member 'HttpsFunction'.

1 import { Change, https, HttpsFunction, Runnable } from 'firebase-functions';
                          ~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/v1.d.ts:1:40 - error TS2305: Module '"firebase-functions"' has no exported member 'Runnable'.

1 import { Change, https, HttpsFunction, Runnable } from 'firebase-functions';

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions