Firebase-functions: An accessor cannot be declared in an ambient context.

Created on 23 Apr 2020  路  6Comments  路  Source: firebase/firebase-functions

I recently updated firebase-functions and all fire base related packages, but I got an error : An accessor cannot be declared in an ambient context. when I tried to build my project.

before this update my project run and deployed successfully to firebase, no any other modification made.

error details:

> tsc -p firebase/tsconfig.json 
node_modules/firebase-functions/lib/apps.d.ts(26,13): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/apps.d.ts(33,21): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(53,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(66,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(100,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(114,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(121,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(128,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(137,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(150,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(159,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/function-builder.d.ts(165,9): error TS1086: An accessor cannot be declared in an ambient context.
node_modules/firebase-functions/lib/handler-builder.d.ts(15,9): error TS1086: An accessor cannot be declared in an ambient context.

jpg

Most helpful comment

Thanks for reporting! Looks like we needed to update our TS version. Will be addressed in https://github.com/firebase/firebase-functions/pull/668. For now you can resolve by running this in your functions directory:

npm i typescript@latest --save-dev

All 6 comments

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@eng-dibo I have the same problem today, It worked fine yesterday. Have you found a solution?

No, but it seems you have to update your typescript version.
@JaquelinaG

Hey all, thanks for reporting this. What typescript version were you on when you got this error, and what typescript version did you downgrade to when you fixed it?

at the time of this error appeared, I used the same Typescript as before updating firebase-tools.
i.e: I didn't update Typescript.
@joehan

Thanks for reporting! Looks like we needed to update our TS version. Will be addressed in https://github.com/firebase/firebase-functions/pull/668. For now you can resolve by running this in your functions directory:

npm i typescript@latest --save-dev

Was this page helpful?
0 / 5 - 0 ratings