domasx2 / testing-library-selector

reusable selectors for @testing-library
MIT License
41 stars 5 forks source link

Unable to import RTLSelector for typing #1

Open ViktorSoroka07 opened 3 years ago

ViktorSoroka07 commented 3 years ago

I want to use RTLSelector in order to type the shared selectors and need RTLSelector exported for that. Can this be done or maybe there is another alternative approach for that?

domasx2 commented 3 years ago

You don't have to explicitly type them, types are inferred. For example in const input = byRole('textbox') , input will be of type RTLSelector. Or do you have some other use case in mind?

ViktorSoroka07 commented 3 years ago

Yeah, but I want to assign the type explicitly.

domasx2 commented 3 years ago

Ok, will export it when I get a moment. In the meantime you can workaround with type RTLSelector = ReturnType<byRole> or smth like that

ViktorSoroka07 commented 3 years ago

Thank you.