You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: Angular - make certain inputs booleanAttributes #30822
I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
This issue was brought up as a bug 5 years ago in #21638, but I'm making it a feature request.
My editor complains when I don't specify the value of certain valid ionic attributes:
<ion-itembuttondetail/>
~~~~~~ ~~~~~
The error is: TS2322: Type string is not assignable to type boolean
It compiles fine and works in my app, but in order to get rid of the complaints of my IDE, I have to specify the values of these attributes as true:
<ion-item[button]="true" [detail]="true"/>
Describe the Use Case
Make these errors go away, and make this approach work! It looks much cleaner.
<ion-itembuttondetail/>
Describe Preferred Solution
Coerce the value of these attributes to booleans:
// Using `coerceBooleanProperty` allows for the disabled value of a button to be set as// `<my-button disabled></my-button>` instead of `<my-button [disabled]="true"></my-button>`.// It also allows for a string to be passed like `<my-button disabled="true"></my-button>`.
@Input()getbutton(){returnthis._button;}setbutton(value: BooleanInput){this._button=coerceBooleanProperty(value);}private_button=false;
@ntorrey Thanks for the report, and sorry for the slow follow-up.
I can't reproduce the editor error. I checked Angular 18 and 21, both the compiler with strictTemplates and the Angular Language Service in VS Code, against Ionic 8 and 9, and <ion-item button detail> comes back clean in all of them. A control component in the same file with a plain @Input() flag!: boolean does error, so the checker was definitely running.
Could you share which editor you use and whether you have the Angular Language Service extension installed, plus your @ionic/angular and @angular/core versions?
Separately, we have a PR adding an input transform to every boolean prop, close to what you suggested. I'd expect it to clear the error for any checker that reads ngAcceptInputType, and I can send you a dev build to confirm against your setup.
No response, so closing this out. As mentioned above, we weren't able to reproduce the warning on our end.
#31442 has since merged and adds the input transform you suggested, landing in v10. If the warning still shows up for you then, open a new issue with your editor and versions and we'll take another look.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
feat(angular): add booleanAttribute transform to IonItem inputs
thetaPC commentedon Sep 21, 2026
@ntorrey Thanks for the report, and sorry for the slow follow-up.
I can't reproduce the editor error. I checked Angular 18 and 21, both the compiler with
strictTemplatesand the Angular Language Service in VS Code, against Ionic 8 and 9, and<ion-item button detail>comes back clean in all of them. A control component in the same file with a plain@Input() flag!: booleandoes error, so the checker was definitely running.Could you share which editor you use and whether you have the Angular Language Service extension installed, plus your
@ionic/angularand@angular/coreversions?Separately, we have a PR adding an input transform to every boolean prop, close to what you suggested. I'd expect it to clear the error for any checker that reads
ngAcceptInputType, and I can send you a dev build to confirm against your setup.thetaPC commentedon Sep 25, 2026
No response, so closing this out. As mentioned above, we weren't able to reproduce the warning on our end.
#31442 has since merged and adds the input transform you suggested, landing in v10. If the warning still shows up for you then, open a new issue with your editor and versions and we'll take another look.
ntorrey commentedon Sep 26, 2026
Thank you! Sorry for my slow response! I'm using Webstorm as my IDE, so maybe it's coming from that. Looking forward to version 10!
ionitron-bot commentedon Oct 26, 2026
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.