docs: fix type for form action example #10693
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.
Problem
The Type for this section is invalid in most typescript configurations since there really is no way of typing
thisfor the event. So, Typescript users may get unnecessarily frustrated copying this code.Fix
Update docs section to use currentTarget which will make this docs section valid in typescript code.
As for the actual style of the fix I tried to keep it simple though it is kindof ugly with the chaining. So, please make an edit if you have a solution that more fits the style of the docs
Tests
I came across this while implementing something similar in my own code. I used this typing and it worked.