Skip to content

Export Queries interface #395

Closed
Closed
@NMinhNguyen

Description

@NMinhNguyen
  • react-testing-library version: 8.0.2
  • react version: 16.8.6
  • node version: 8.9.0
  • yarn 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 type DrawStyle, 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 the DrawStyle.

I'm happy to raise a PR for this if this request is deemed reasonable.

interface Queries {

-interface Queries {
+export interface Queries {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions