Home > Software engineering >  Property assignment expected. This expression is not callable. Type {} has no call signatures. (how
Property assignment expected. This expression is not callable. Type {} has no call signatures. (how

Time:10-15

I wanted to update a badge count in a chat room using cloud function trigger which is a nested map. I'm updating badges in the frontend without any issue but I want the create a cloud function for this to reduce frontend workloads. but when I tried to pass a dynamic variable as field/key, the compiler is not happy and it's giving me an error.

enter image description here

the expected output should be like this

enter image description here

Backtick doesn't work so I tried to change the backtick to double quote to be able to compile, but this was the output which is not what i want.

enter image description here

anyone knows how to make this work? please help.

CodePudding user response:

its syntax issue, missing [ & ]. it should be { [`badgeCount.${receveid}`]: fire.....

  • Related