-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: revert improve type safety in retargeting proxy setter #930
Merged
alvarosabu
merged 3 commits into
main
from
fix/revert-6d8e742646618bbf40b192bfe5dafa376f8780fe
Feb 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
cf84887
Revert "fix: improve type safety in retargeting proxy setter"
alvarosabu a4b34e5
Merge branch 'main' into fix/revert-6d8e742646618bbf40b192bfe5dafa376…
alvarosabu 857050b
refactor(createRetargetingProxy): remove unneeded Partial type from s…
andretchen0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(non-blocking)
This was showing up as a build error previously ( #924 ). I haven't been able to track down the issue yet, but I think it's due to TS compiler configuration.
My guess is that for
Partial<Record>
, we have a different configuration in the editor vs. build, but I haven't been able to track down exactly where.But the behavior here is consistent with adding/removing the
--exactOptionalPropertyTypes
compiler option described in this SO question.The intention for
setters
is that all values are functions, never explicitlyundefined
.setters
is currently aPartial<Record>
. Depending on configuration, TS will allowPartial<Record>
keys to be set toundefined
, even if that's not an allowed value in the specificRecord
type. That would be consistent with the reported build error.setters
doesn't need to be aPartial
. SoPartial
could be removed from its type in this function's arguments. That will keep TS from complaining thatundefined
values need to be checked, regardless of--exactOptionalPropertyTypes
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a change that removes the
Partial
from thesetters
argument type.It's been part of
createRetargetingProxy
since I wrote it, but it was ultimately unnecessary.Removing it will avoid the build error whether TS is configured with or without
--exactOptionalPropertyTypes
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I can think of is that the difference between editor and build could be a difference in the versions available in the node modules perhaps? Lets keep an eye on the build typescript issue to see what could be causing the difference between a version or another
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andretchen0 should merge this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it's ready to merge.