Skip to content

[Ionic 4] error TS2339: Property 'width' does not exist on type 'HTMLIonMenuElement'. #14794

Closed

Description

@peterpeterparker

Ionic Info

v4.0.0-alpha.9

Support Question

In v3 Menu use to expose a width() method. Didn't found it in v4. Did I miss something or are they still on the roadmap?

Code

 const menu: HTMLIonMenuElement = await this.menuController.get('myMenu');
 menu.width();

Activity

  1. self-assigned this
    on Jul 23, 2018
  2. peterpeterparker commented on Jul 24, 2018

    @peterpeterparker
    ContributorAuthor

    In v4.0.0-alpha.12 getWidth is there, could confirm it compiles

    I'm not there to test it but looks good

    Side note:

    In Ionic v3 method's name is width() and in v4 getWidth() just in case someone would land on that in the future

  3. brandyscarney commented on Jul 30, 2018

    @brandyscarney
    Member

    @manucorporat Can we document the breaking change for the method name?

  4. peterpeterparker commented on Aug 2, 2018

    @peterpeterparker
    ContributorAuthor

    Ok so I just tested, I probably did something wrong, but I was unable to get the width of the menu thru this exposed function, I always get undefined

    But I found I guess a workaround

    const menu: HTMLIonMenuElement = await this.menuController.get('myMenu');
    console.log(menu.getWidth()); // --> undefined
    console.log(menu.clientWidth); // --> the width of the menu
    
  5. ionitron-bot commented on Sep 1, 2018

    @ionitron-bot

    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.

  6. locked and limited conversation to collaborators on Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions