New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with "noImplicitAny": true fails #213

swftvsn opened this Issue Apr 4, 2018 · 3 comments


None yet
3 participants

swftvsn commented Apr 4, 2018

Version info

Typescript 2.8.1




Steps to reproduce

Use above versions and try to build. Used tsconfig.json:

  "compilerOptions": {
    "lib": ["es6", "es2015.promise", "dom"],
    "module": "commonjs",
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": false,
    "outDir": "build",
    "sourceMap": false,
    "target": "es6",
    "typeRoots" : ["./src/_shared-functions/types", "./src/_shared/types", "./node_modules/@types"]
  "include": [

Were you able to successfully deploy your functions?

Can't build.

Expected behavior

I can build.

Actual behavior

Running node_modules/typescript/bin/tsc produces error

node_modules/firebase-functions/lib/cloud-functions.d.ts(62,58): error TS7006: Parameter 'any' implicitly has an 'any' type. 

The offending file contains:

export declare namespace Change {
    /** Factory method for creating a Change from a `before` object and an `after` object. */
    function fromObjects<T>(before: T, after: T): Change<T>;
    /** Factory method for creating a Change from a JSON and an optional customizer function to be
     * applied to both the `before` and the `after` fields.
    function fromJSON<T>(json: ChangeJson, customizer?: (any) => T): Change<T>;

Which translates to this line:

export function fromJSON<T>(json: ChangeJson, customizer: (any) => T = reinterpretCast): Change<T> {

Which should probably read

export function fromJSON<T>(json: ChangeJson, customizer: (a: any) => T = reinterpretCast): Change<T> {

Or something similar?

I can build with "noImplicitAny": false fine though, so there's no rush.


This comment has been minimized.

wcandillon commented Apr 24, 2018

@laurenzlong When will this update be available?


This comment has been minimized.


laurenzlong commented Apr 24, 2018

It was just made available in 1.0.2


This comment has been minimized.

wcandillon commented Apr 25, 2018

@laurenzlong Yes that works, thank you, really appreciate it 🙌🏻

laurenzlong added a commit that referenced this issue Aug 9, 2018

hgwood added a commit to Zenika/humeur-du-mois-2018 that referenced this issue Oct 25, 2018

♻️ switch noImplicitAny back on (#44)
We had to switch the `noImplicitAny` TypeScript compiler option off when [upgrading to `firebase-functions@1.0.0`](65a6108#diff-dc8de0a814a0e019ed6c1deb12c75cfeR13) because it is not compatible with it (see [this issue](firebase/firebase-functions#213)). However since then `firebase-functions`  has been patched, and we've upgraded so we should be able to turn the option back on.

When I tried to turn it on, the compiler detected a few places where the code was relying on some legitimate implicit anys. But it did also complain about 2 other packages that were not compatible with the option, because they were lacking types. These packages are `lodash.partition` and `firebase-tools`.

I chose to remove `lodash.partition` because I felt it was not pulling its weight, as suggested by @brunosabot  [here](#12 (comment)).

On the other hand, we really need `firebase-tools`, but this time instead of turning `noImplicitAny` off because of it, I took the time to study how it can be left on while using packages without types. It turns out it is possible to write your own type declarations for a module installed from npm, though it took a bit of trial and error to get there. I've documented what works in `@types/`, and I've written a type declaration for the one and only function that we use from the package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment