question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTMLOptionElement gives error Property 'value' does not exist on type 'Element'.

See original GitHub issue

I’m getting this in this case of an HTMLOptionElement value

image

It should have that value as HTMLOptionsCollection contains HTMLOptionElement elements: readonly options: HTMLOptionsCollection;

interface HTMLOptionsCollection extends HTMLCollectionOf<HTMLOptionElement> {
    length: number;
    selectedIndex: number;
    add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void;
    remove(index: number): void;
}

Using typescript@2.2.1

My workaround was to use an unnecessary cast let newValue = (target.options[newSelectedIndex] as HTMLOptionElement).value

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
marcus-pettycommented, Feb 21, 2018

Please fix!

0reactions
quantuminformationcommented, Feb 21, 2018

That would be awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript - The property 'value' does not exist on value of type ...
Based on Tomasz Nurkiewiczs answer, the "problem" is that typescript is typesafe. :) So the document.getElementById() returns the type ...
Read more >
How To Fix The Property 'value' does not exist on type ...
You would run into the error. The reason for this is that document.getElemetById() has a return value of HTMLElement | null . As...
Read more >
Property 'value' does not exist on type 'HTMLElement' in TS
The error "Property 'value' does not exist on type 'HTMLElement'" occurs when we try to access the value property on an element that...
Read more >
property value does not exist on type htmlelement - YouTube
Your browser can't play this video. ... property value does not exist on type htmlelement | React NextJS Typescript. 1,912 views1.9K views.
Read more >
HTMLOptionElement - Web APIs | MDN
Chrome Edge HTMLOptionElement Full support. Chrome1. Toggle history Full support. Edge12. Toggle hi... Option() constructor Full support. Chrome1. Toggle history Full support. Edge12. Toggle hi... defaultSelected...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found