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

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

Closed
am11 opened this issue Nov 23, 2015 · 8 comments
Closed

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

am11 opened this issue Nov 23, 2015 · 8 comments
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@am11
Copy link

am11 commented Nov 23, 2015

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.

@mhegazy mhegazy added Suggestion An idea for TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this labels Nov 23, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Nov 23, 2015

PRs are appreciated. here is how to send lib.d.ts PRs: https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes

@lugolven
Copy link

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

@mhegazy
Copy link
Contributor

mhegazy commented Dec 1, 2015

@lgolven feel free to send a PR for it.

@MartyIX
Copy link
Contributor

MartyIX commented Dec 20, 2015

I have added PR here: microsoft/TypeScript-DOM-lib-generator#35

@MartyIX
Copy link
Contributor

MartyIX commented Dec 22, 2015

@mhegazy Is this a correct way to fix the problem?

@DanielRosenwasser
Copy link
Member

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

@duanyao
Copy link

duanyao commented Apr 13, 2016

Well, Element.outerHTML is still missing :(

@RyanCavanaugh
Copy link
Member

@duanyao Be the pull request you want to see in the world 😉

mixonic added a commit to mixonic/glimmer that referenced this issue Apr 21, 2016
Some versions of TypeScript require manual casting of elements to allow
innerHTML to be accessed. See:

microsoft/TypeScript#5754
microsoft/TypeScript-DOM-lib-generator#35
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

8 participants