Description
react-testing-library
version: 8.0.2react
version: 16.8.6node
version: 8.9.0yarn
version: 1.16.0
Relevant code or config:
export function render<Q extends Queries>(
ui: React.ReactElement<any>,
options: MyCustomRenderOptions<Q>,
): RenderResult<Q>
What you did:
I would like to provide typings for a custom render
function https://testing-library.com/docs/react-testing-library/setup#custom-render where I allow an extra configuration option (theme
in my particular case). Now I'm not a TS guru, but my assumption is that I would have to copy the current definition of render
and customise options
.
What happened:
Module '"bla/node_modules/@testing-library/react/typings/index"' has no exported member 'Queries'. Did you mean 'queries'?
Reproduction:
Problem description:
See above.
Suggested solution:
I think Queries
should be exported. https://github.com/microsoft/web-build-tools/blob/master/apps/api-extractor/README.md says
Missing exports: Suppose the awesome-widgets package exports an API function
AwesomeButton.draw()
that requires a parameter of typeDrawStyle
, but you forgot to export this enum. Things seem fine at first, but when a developer tries to call that function, they discover that there's no way to specify theDrawStyle
.
I'm happy to raise a PR for this if this request is deemed reasonable.
react-testing-library/typings/index.d.ts
Line 15 in 8e99f3c
-interface Queries {
+export interface Queries {