Skip to content

error: Property 'innnerHTML' does not exist on type 'Element' #5754

Closed

Description

@am11

I am getting this error with v1.6.3 with the following code:

document.querySelector('body>section.container').innerHTML  // error: TS2339

To remedy it, I had to explicitly cast it as HTMLElement:

(<HTMLElement>document.querySelector('body>section.container')).innerHTML  // it works!

However, innerHTML is supported by Element interface:
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML.

Activity

  1. mhegazy commented on Nov 23, 2015

    @mhegazy
    Contributor
  2. lugolven commented on Nov 27, 2015

    @lugolven

    I would like to try to fix this bug, is it possible to assigned it to me ?
    Thanks !

  3. mhegazy commented on Dec 1, 2015

    @mhegazy
    Contributor

    @lgolven feel free to send a PR for it.

  4. added this to the milestone on Dec 1, 2015
  5. MartyIX commented on Dec 20, 2015

    @MartyIX
    Contributor
  6. MartyIX commented on Dec 22, 2015

    @MartyIX
    Contributor

    Mohamed Hegazy (@mhegazy) Is this a correct way to fix the problem?

  7. modified the milestones: TypeScript 1.8, on Dec 22, 2015
  8. DanielRosenwasser commented on Dec 22, 2015

    @DanielRosenwasser
    Member

    Thanks MartyIX! This will just need to be synced up with the repo.

  9. duanyao commented on Apr 13, 2016

    @duanyao

    Well, Element.outerHTML is still missing :(

  10. RyanCavanaugh commented on Apr 13, 2016

    @RyanCavanaugh
    Member

    Duan Yao (@duanyao) Be the pull request you want to see in the world 😉

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions