You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The as unknown as T casts are begrudgingly required due to a known limitation of the TypeScript compiler as demonstrated in the following issues for example:
Perhaps someone interested in the topic and who has time to work on it would be willing to take a look into the issue.
Either way, until a resolution is merged into the TypeScript compiler that addresses this issue, we need to use this workaround. We could also remove this if we manage find a reasonable, more fitting workaround of some sort to avoid casting in the first place. If a workaround / change of implementation comes to mind, please raise an issue on the repository or feel free to open a PR!
This discussion was converted from issue #207 on April 15, 2024 07:42.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Expected Behavior
Typescript gets smart.
Actual Behavior
Typescript is not smart.
Steps to Reproduce the Problem
src/components/ReactP5WrapperGuard.tsx
.src/components/ReactP5WrapperWithSketch.tsx
.as unknown as T
shenanigans.The
as unknown as T
casts are begrudgingly required due to a known limitation of the TypeScript compiler as demonstrated in the following issues for example:As Ryan Cavanaugh points out:
Potentially this would have been resolved by this PR but the author closed it due to lack of time:
Perhaps someone interested in the topic and who has time to work on it would be willing to take a look into the issue.
Either way, until a resolution is merged into the TypeScript compiler that addresses this issue, we need to use this workaround. We could also remove this if we manage find a reasonable, more fitting workaround of some sort to avoid casting in the first place. If a workaround / change of implementation comes to mind, please raise an issue on the repository or feel free to open a PR!
Specifications
Package Version: 4.0.0 and above
Beta Was this translation helpful? Give feedback.
All reactions