I am using the React type definitions for my project. I notice it is missing the focus method on elements in the array returned by the refs property - so I cannot get this example to work. Basically, the compiler says: property 'focus' does not exist on type 'Component <any, any> | Element'
. This is because focus exists on type HTMLElement not Element. Either the definition file should specify the return type of refs as | HTMLElement
or some other extended interface that includes focus method (I'm not sure which but that's not the point of my question).
My question is: what should I do now? I am stuck from continuing development!
I know I could fork the definition file and patch it myself but this seems to be a problem I keep coming up with in TypeScript and was wondering if there was a less cumbersome solution that means I can move quickly. It seems that I keep having to step out of my tracks in building my app to often do TypeScript patching!