I have the below snippet of code that throws the error Unsafe assignment of an any value on this line value={country.currency?.code ?? country.name}. countries is a json import, I can't understand why this error is shown in ts since I am providing a default value.
<AuthSelect
id="outlined-basic"
placeholder="Enter your currency"
label="Currency"
>
{countries.map(country => (
<option
key={country.code}
value={country.currency?.code ?? country.name}
>
{country.currency?.code ?? country.name}
</option>
))}
</AuthSelect>
This is the implicit type generated by typescript
(property) "currency"?: {
code: string;
name: string;
symbol: string;
} | {
code: string;
name: string;
symbol: boolean;
} | {
code: string;
name: string;
symbol: string;
} | {
code: string;
name: string;
symbol: boolean;
} | undefined