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.
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
perf(core): make sanitization tree-shakable in Ivy mode #31934
perf(core): make sanitization tree-shakable in Ivy mode #31934
Changes from 6 commits
aaf1e6a
f665f03
3f4d642
17bfa25
1cb3475
c1ef23b
037ec02
cb09fe1
687049f
f0e8457
5877a1d
51728b0
027f415
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
why did you remove the branded interface? without it the meaning of these interfaces is lost because due to structural typing you can't ensure type safety: http://www.typescriptlang.org/play/#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgZU3WADVMAbAVzwG8BfAKAdElkRTS1wKOAAkYAW3JxQqJABMAzj2JkqtRs3DR4yVBhx5CxfDACe5PGOCSZO0hWpx6TFqvYau23vmxQEYeCbOzLCmyUGOEwAIykYKBx4bHJMKXNeeWoASUEwEQR0o0FTGES5K1pguGwIJAioSmwYaAAKMEpQ8gRsUoALTCQAc2RugBV2hCkAIShgTABrKQBBMAzWzBgEcvxgbEoPAwAuOEq+gEobErg4AHoz0XSDEqVTkPDI6Lhu4Bh+-TBgADlMXLqDrt9j0ANxMe61PQeHoA473ODjGCbJBwAAGFmSeEElAicBxeAA2mAoBAvrB9ABdAC8oWQEj6uwAJDQYEMpAA6bCdHp9QbDMYTaZzBbYJYrJBrDZbfR0VFwADUJ3haLgdSkwDw7RgMDA2wu3U5EDOPTO6qlCAMAGIQAkDqiwadGHdYvECvwhOQ0hlRCBxNI-JivZlssBcig3QJhHCXm8Pl9fv8jjQEW9kXAAOQAZnTILgToYLoSfj0hmAQZ9frdgeyiBDYfyxYMRmjr3enx+f2AsOTiLT6YALDm8wwlPY2OhKEgauK8UgAO5RMAYop1ABuRV2y4USZKvagKLXRRCVaKQYOnO5vR6fNG4yms3mLVFy1W602Fv0YKUZQq8BAcCpOAkGAOc-EjT1sjqdMpHTA4wQYCcpxfFFUAiOp0E3Vwm2AHd4T3FF0C-JgLjgVlhlI9suXWaY4HKch9DgUJ1niFxiHAkJJEbUsQnGPZImqJEono0j2jwKROwLcpcS1YRMLYj0ANI4A0JAOCGCAA
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 did not remove anything, I just moved it from
platform-browser
to thecore
. We could add additional branding if you would like, but that is not what we had in the past.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.
Oh I see what you are doing... rather than use branded types you have switched to using real classes (e.g.
SafeValueImpl
and descendants).But in that case I don't see any value in having both real implementations and interfaces... especially since the interfaces are all semantically identically now...
Why not just make them all classes and ditch the interfaces?
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.
That would be a breaking change.
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.
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.
No, I actually want this to be sensitive to
null
andundefined
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.
At least in the compiler we have been trying to be more explicit about these things, so if we wanted to compare both
null
andundefined
then we would write it out explicitly using===
. This would ensure people like @IgorMinar don't mistake this sort of comparison as an error. I think the minimizer might be able to collapse such comparisons back to==
at bundling time so there is no benefit in using it in the source.Alternatively, I think a comment explaining why
!==` would help.
!=
is being used rather thanThere 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.
So I think this function will:
true
ifactualType === type
actualType
isResourceUrl
andtype
isUrl
false
: ifactualType === null
andtype !== null
actualType === undefined
andtype !== undefined
Is that correct? It is not so obvious to glean that from reading the code.
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.
Do you have suggestions as to make it more clear?