fix: fix circularity on JSHandle interface #9661
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the ongoing problem related to circularity on the JSHandle.
For background, the original implementation attempted to make use of the fact the
this
object was aJSHandle
of typeT
. Since theEvaluateFunc
type flatten handles, it's assumed the compiler could deal withthis
which it does. However, this causes another problem to arise where the return type is considered self-referencing because the return type is derived fromEvaluateFunc<[this,...
which looks somewhat likeEvaluateFunc<[EvaluateFunc<[EvaluateFunc<[...,...,...,...
to the compiler.Our solution here is to flatten the
this
value to the actual type we want. This way no inference is needed, so the compile doesn't see the circular type above.