Using typescript and react with TSX files with definitely typed type definitions, I am getting the error:
error TS2339: Property 'for' does not exist on type 'HTMLProps<HTMLLabelElement>'.
When trying to compile a component with the following TSX
<label for={this.props.inputId} className="input-label">{this.props.label}</label>
I have already solved but adding here for the next person since the solution didn't show up anywhere when searching (Google or StackOverflow)
Best Answer
The solution was to change the
for
attribute tohtmlFor
This is a part of the React library itself which apparently handles
for
differently just like it doesclass
(it usesclassName
) and not an issue with the definitely typed type definitions.