XGG
XGG

Reputation: 51

Typescript casting error to get input value

I have not been able to find out why this error is occurring and no one else seem to share my error, any insights? This is my first using TypeScript.

Tell me if you need more information or coding examples.

Upvotes: 1

Views: 139

Answers (1)

x1n13y84issmd42
x1n13y84issmd42

Reputation: 970

Is it a .tsx file? If so, it might be a parsing issue - <HTMLInputElement> is recognized as an opening React tag instead of a TS type casting expression. Try working it around with the as casting:

(document.getElementById('ulvl') as HTMLInputElement).value

Upvotes: 1

Related Questions