Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

(solved) Type ‘string | null’ is not assignable to type ‘string’ while working with PCF

(solved) Type ‘string | null’ is not assignable to type ‘string’ while working with PCF

While working with PCF you might get the below error.

Type ‘string | null’ is not assignable to type ‘string’.

Solution

Make sure you have a default value for the value you’re trying to get. In this case, I had to default to empty string.

Hope this helps.