ionic-team / ionic-angular-standalone-codemods

MIT License
16 stars 8 forks source link

bug: The types defined in `ContentChild` and `ElementRef` are for `@ionic/angular`, not `@ionic/angular/standalone`. #23

Closed rdlabo closed 1 year ago

rdlabo commented 1 year ago

Prerequisites

Codemod version

v0.0.5

Current Behavior

import { IonIcon } from '@ionic/angular';
...
@ContentChild('LocationIcon')
private readonly iconEl: {
  el: IonIcon & HTMLElement;
};

public async ngOnInit() {
  this.iconEl.el.name = 'locate';
}
error TS2339: Property 'name' does not exist on type 'IonIcon & HTMLElement'.
[ng] 
[ng] 72                             this.iconEl.el.name = 'locate';
[ng]                                               ~~~~

Expected Behavior

The migrate should complete without error.

Steps to Reproduce

import { IonIcon } from '@ionic/angular';
...
@ContentChild('LocationIcon')
private readonly iconEl: {
  el: IonIcon & HTMLElement;
};

public async ngOnInit() {
  this.iconEl.el.name = 'locate';
}

Code Reproduction URL

No response

Additional Information

export declare class IonIcon {
    protected z: NgZone;
    protected el: HTMLElement;
    constructor(c: ChangeDetectorRef, r: ElementRef, z: NgZone);
    static ɵfac: i0.ɵɵFactoryDeclaration<IonIcon, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<IonIcon, "ion-icon", never, { "color": "color"; "flipRtl": "flipRtl"; "icon": "icon"; "ios": "ios"; "lazy": "lazy"; "md": "md"; "mode": "mode"; "name": "name"; "sanitize": "sanitize"; "size": "size"; "src": "src"; }, {}, never, ["*"], false>;
}
export declare class IonIcon {
    protected z: NgZone;
    protected el: HTMLElement;
    constructor(c: ChangeDetectorRef, r: ElementRef, z: NgZone);
    static ɵfac: i0.ɵɵFactoryDeclaration<IonIcon, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<IonIcon, "ion-icon", never, { "color": "color"; "flipRtl": "flipRtl"; "icon": "icon"; "ios": "ios"; "lazy": "lazy"; "md": "md"; "mode": "mode"; "name": "name"; "sanitize": "sanitize"; "size": "size"; "src": "src"; }, {}, never, ["*"], true>;
}
rdlabo commented 1 year ago

IonContent has same issue. Probably all Types that have referenced types will have similar problems.

rdlabo commented 1 year ago

I guess I was wrong about this.

ionitron-bot[bot] commented 11 months ago

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 the codemods, please create a new issue and ensure the template is fully filled out.