When I attempt to parse a JSON-formatted string, a linter error is triggered:
let mqttMessage = JSON.parse(message.toString())
// ESLint: Unsafe assignment of an `any` value. (@typescript-eslint/no-unsafe-assignment)
Given that I am in control of the content of message
, I'm interested in explicitly informing TypeScript that the result of JSON.parse()
is actually an Object. Is there a recommended approach for achieving this?
Please note that although I could suppress the warning, I prefer to explore alternative solutions to address the issue.