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

Support non-standard DOM properties #31

Closed
gaearon opened this issue Nov 18, 2014 · 1 comment
Closed

Support non-standard DOM properties #31

gaearon opened this issue Nov 18, 2014 · 1 comment

Comments

@gaearon
Copy link
Contributor

gaearon commented Nov 18, 2014

The following code

function getInnerText(el: Element): string {
  return el.textContent || el.innerText || '';
}

outputs

getInnerText.js:5:28,39: property innerText
Property not found in .../lib/dom.js:272:1,299:1: Element

getInnerText.js:5:28,39: property innerText
Property not found in .../lib/dom.js:301:1,316:1: HTMLElement

Indeed, innerText is non-standard, but how do I get around this?

@avikchaudhuri avikchaudhuri added incompleteness Something is missing enhancement and removed incompleteness Something is missing labels Nov 19, 2014
@mroch
Copy link
Contributor

mroch commented Jun 17, 2015

it wasn't possible at the time, but now you can downcast to any: ((el : any).innerText : string)

I think the more general solution will be to let you extend the built-in types (#396) so you can add this property if you want to allow it, without allowing it in other environments.

@mroch mroch closed this as completed Jun 17, 2015
This was referenced Jul 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants