I am getting the lint error:
don't use object as a type
When I use object as a type, example follows:
export const myFunc = (obj: object): string => {
return obj.toString()
}
Any idea what type I should give to an object with unknown properties?
If it helps the object in question is NOT an array (which I know is strictly an object in JS)
Thanks in advance
There's a few different ways to do this. Generally I feel the need for this is a bit of an anti-pattern.
But I would probably go for Record<string, any>
, if that covers it for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With