You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears I can't use type casting in React TSX files.
Say I have this expression in some method of the React TSX component:
var editTitle = <EditableField>this.refs['editTitle'];
This line is supposed to be: fetch the child component ref'd as "editTitle" and cast it to the type EditableField, so that I can then access methods of EditableField in a strongly-typed manner.
But the typescript compiler appears to be treat that cast expression as a React element creation expression instead, being inside a TSX file and all.
Is it even possible to cast objects inside a React TSX component?
The text was updated successfully, but these errors were encountered:
It appears I can't use type casting in React TSX files.
Say I have this expression in some method of the React TSX component:
var editTitle = <EditableField>this.refs['editTitle'];
This line is supposed to be: fetch the child component ref'd as "editTitle" and cast it to the type EditableField, so that I can then access methods of EditableField in a strongly-typed manner.
But the typescript compiler appears to be treat that cast expression as a React element creation expression instead, being inside a TSX file and all.
Is it even possible to cast objects inside a React TSX component?
The text was updated successfully, but these errors were encountered: