Probably a dumb question but why this dont work:
I’m getting this error: TS2345: Argument of type {} is not assignable to parameter of type string | number | boolean
function foo (value: unknown) {
let resolvedValue = '';
if (typeof value === 'undefined') resolvedValue = '';
else if (Array.isArray(value)) resolvedValue = '';
else if (typeof value === 'object') resolvedValue = '';
else resolvedValue = encodeURIComponent(value); // function that only accepts string, number and boolean
return resolvedValue;
}
It’s probably something that i don’t know or don’t understand about typescript / javascript…
Thanks for the patience ❤️