Type „HTMLFormControlsCollection” nincs tulajdon „x” és nincs karakterlánc indexaláíráshoz

szavazat
0

Ez a hiba, amikor megpróbálja destructure egy form.elementsobjektumot.

// in a class

domRefs: {[key: string]: HTMLFormElement | null} = {
  myForm: null
}

onButtonClick = () => {
  console.debug(this.domRefs.myForm!.elements) // screenshot below
  const {a, b, c} = this.domRefs.myForm!.elements
}

írja

Nem akarom használni a : anytípus, amely nem bocsát ki ezt a hibát.

A kérdést 02/04/2018 11:48
a forrás felhasználó
Más nyelveken...                            

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more