Skip to content
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

Renderer.setElementAttribute's attributeValue parameter and strictNullChecks #13686

Closed
Dema opened this issue Dec 28, 2016 · 3 comments
Closed

Comments

@Dema
Copy link

Dema commented Dec 28, 2016

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
This is more a stylistic thing, but

this.renderer.setElementAttribute(this.el.nativeElement, 'data-some-param', undefined);

is a legal usage as it deletes data-some-param attribute from element, but this code shows typescript error when using strictNullChecks because setElementAttribute is described as:

abstract setElementAttribute(renderElement: any, attributeName: string, attributeValue: string): void;

attributeValue is just string and not string | undefined

Expected behavior

attributeValue to have type string | undefined
Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Angular version: 2.2.4

https://github.com/angular/angular/blob/master/modules/%40angular/core/src/render/api.ts
still the same in latest Angular

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

@DzmitryShylovich
Copy link
Contributor

Duplicate of #11844

@pkozlowski-opensource
Copy link
Member

Closing as a duplicate of #11844, thnx @DzmitryShylovich

Manduro added a commit to Manduro/angular that referenced this issue May 27, 2017
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
mhevery pushed a commit to Manduro/angular that referenced this issue Jul 26, 2017
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
mhevery pushed a commit to Manduro/angular that referenced this issue Oct 12, 2018
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
mhevery pushed a commit that referenced this issue Oct 12, 2018
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 #13686

PR Close #17065
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this issue Jan 3, 2019
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
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants