I’m getting this error:
<code>TS2345: Argument of type {} is not assignable to parameter of type string | number | boolean
</code>
<code>TS2345: Argument of type {} is not assignable to parameter of type string | number | boolean
</code>
TS2345: Argument of type {} is not assignable to parameter of type string | number | boolean
<code>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;
}
</code>
<code>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;
}
</code>
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;
}