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(core): allow undefined value for renderer setElement(…) #17065
Conversation
Note this is a breaking change and should be held until the first v5 beta. It is not breaking for callers of callers of the render API but it is breaking for the implementors as they need now need to change the type of the third parameter to a union with |
Consider changing the commit message to |
@chuckjaz I'm not sure if this really is a breaking change. Can you provide an example where existing code would break? Both functions where I'm changing the signature have checks for null/undefined's: here and here. |
@Manduro I removed the breaking change tag. It turns out that TypeScript is tolerant of incorrectly typed overrides. The issue I had is with implementations of abstract class Base {
abstract setElementAttribute(renderElement: any, attributeName: string, attributeValue: string): void;
}
class Derived extends Base {
setElementAttribute(renderElement: any, attributeName: string, attributeValue: string): void { }
} Changing const b: Base = new Derived();
b.setElementAttribute(1, 'attr'); which will pass It appears that TypeScript is tolerant of this kind of incorrect override declaration so this doesn't break and we can take this change because all implementation were written prior to strict null checking and wouldn't have relied on |
Ah yes, hadn't considered that. Glad it's not a problem. I'm not touching Renderer2 by the way, to be clear. It has separate methods for adding and removing attributes and styles. |
RE: |
aa8f213
to
40228b5
Compare
@Manduro what is the status of your pull request? is it still relevant? |
@splincode I guess it is as renderer v1 is still in the codebase, although it might not be long before it's removed. Don't know why this was never merged. |
Using Renderer’s setElementAttribute or setElementStyle with a null or undefined value removes the corresponding attribute or style. The argument type should allow this when using strictNullChecks. Closes angular#13686
40228b5
to
7af8992
Compare
Using Renderer’s setElementAttribute or setElementStyle with a null or undefined value removes the corresponding attribute or style. The argument type should allow this when using strictNullChecks. Closes angular#13686 PR Close angular#17065
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
Renderer (V1) issue #13686, which has been closed but not fixed.
What is the new behavior?
Using Renderer’s setElementAttribute or setElementStyle with a null or undefined value removes the
corresponding attribute or style. The argument type now allows this when using strictNullChecks.
Does this PR introduce a breaking change? (check one with "x")
Other information: