react-router-test-context icon indicating copy to clipboard operation
react-router-test-context copied to clipboard

Add TypeScript type definitions

Open vittorio opened this issue 7 years ago • 2 comments

Hello!

I use typescript in my project and it would be perfect to have type definitions for your library. http://definitelytyped.org/

Thanks.

vittorio avatar Jan 09 '18 14:01 vittorio

If someone were to open a PR that adds TypeScript (or Flow) types, I would be happy to merge it.

pshrmn avatar Jan 09 '18 15:01 pshrmn

For anyone looking for a place to start for type definitions:

declare module "react-router-test-context" {
  import { match, RouteComponentProps, RouterChildContext, StaticContext } from "react-router";

  type ReactRouterTestContext<P = any> = RouterChildContext<P> & { router: { staticContext: StaticContext } };

  interface ReactRouterTestContextOptions<P = any, C extends StaticContext = StaticContext> extends Partial<RouteComponentProps<P, C>> { }

  export default function(options?: ReactRouterTestContextOptions): ReactRouterTestContext;
}

Hope that helps.

cc: @pshrmn

nzacca avatar May 10 '18 01:05 nzacca