Skip to content

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

@quantuminformation

Description

@quantuminformation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions