'How to double cast a value in JSDoc typescript?
Getting the TS 2352 error:
Conversion of type 'X' to type 'Y' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. ... ts(2352)
How do I convert the expression to 'unknown' first? I am already doing a single cast in JSDoc typescript:
/** @type {Y} */ (variableOfTypeX)
I can't find the documentation for this anywhere.
Solution 1:[1]
By trying and failing, I found that is how to double cast a value in JSDoc typescript (first to unknown and then to Y):
/** @type {Y} */ (/** @type {unknown} */ (variableOfTypeX))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Magne |
