@types/wouter
Advanced tools
| import { MatcherFn } from "./index"; | ||
| export default function makeMatcher( | ||
| makeRegexpFn?: ( | ||
| pattern: string, | ||
| keys?: Array<{ name: string | number }> | ||
| ) => RegExp | ||
| ): MatcherFn; |
| import { Path } from "./index"; | ||
| declare function staticLocationHook( | ||
| path?: Path | ||
| ): () => [Path, (x: Path) => Path]; | ||
| export = staticLocationHook; |
| import { LocationTuple } from "./index"; | ||
| export default function useLocation(): LocationTuple; |
+24
-19
@@ -1,2 +0,2 @@ | ||
| // Type definitions for wouter 1.2 | ||
| // Type definitions for wouter 2.0 | ||
| // Project: https://github.com/molefrog/wouter#readme | ||
@@ -7,3 +7,8 @@ // Definitions by: Tolkunov Alexander <https://github.com/StrayFromThePath> | ||
| import * as React from 'react'; | ||
| import { | ||
| FunctionComponent, | ||
| ComponentType, | ||
| ReactElement, | ||
| ReactNode | ||
| } from "react"; | ||
@@ -13,11 +18,13 @@ export type Params = { [paramName: string]: string } | null; | ||
| export type PushCallback = (to: string) => void; | ||
| export type LocationTuple = [Path, PushCallback]; | ||
| export type Match = [boolean, Params]; | ||
| export type MatcherFn = (pattern: string, path: Path) => Match; | ||
| export interface RouteProps { | ||
| children?: ((params: Params) => React.ReactNode) | React.ReactNode; | ||
| children?: ((params: Params) => ReactNode) | ReactNode; | ||
| path: Path; | ||
| component?: React.ComponentType<any>; | ||
| component?: ComponentType<any>; | ||
| match?: boolean; | ||
| } | ||
| export const Route: React.FunctionComponent<RouteProps>; | ||
| export const Route: FunctionComponent<RouteProps>; | ||
@@ -27,6 +34,6 @@ export interface LinkProps { | ||
| href?: string; | ||
| children: React.ReactElement; | ||
| children: ReactElement; | ||
| onClick?: () => void; | ||
| } | ||
| export const Link: React.FunctionComponent<LinkProps>; | ||
| export const Link: FunctionComponent<LinkProps>; | ||
@@ -41,17 +48,15 @@ export interface RedirectProps { | ||
| location?: string; | ||
| children: Array<React.ReactElement<RouteProps>>; | ||
| children: Array<ReactElement<RouteProps>>; | ||
| } | ||
| export const Switch: React.FunctionComponent<SwitchProps>; | ||
| export const Switch: FunctionComponent<SwitchProps>; | ||
| export interface History { | ||
| path: () => Path; | ||
| push: PushCallback; | ||
| subscribe: (cb: PushCallback) => () => void; | ||
| } | ||
| export interface RouterProps { | ||
| history: History; | ||
| matcher: (pattern: string, path: Path) => Match; | ||
| hook: () => LocationTuple; | ||
| matcher: MatcherFn; | ||
| } | ||
| export const Router: React.FunctionComponent<Partial<RouterProps>>; | ||
| export const Router: FunctionComponent< | ||
| Partial<RouterProps> & { | ||
| children: ReactElement | ReactElement[]; | ||
| } | ||
| >; | ||
@@ -62,2 +67,2 @@ export function useRouter(): RouterProps; | ||
| export function useLocation(): [Path, PushCallback]; | ||
| export function useLocation(): LocationTuple; |
| { | ||
| "name": "@types/wouter", | ||
| "version": "1.2.0", | ||
| "version": "2.0.0", | ||
| "description": "TypeScript definitions for wouter", | ||
@@ -24,4 +24,4 @@ "license": "MIT", | ||
| }, | ||
| "typesPublisherContentHash": "91c8c419e528bdf38ce99bfaac3dbb554cd17df9dfe78cfe1089ab8688c34bc1", | ||
| "typesPublisherContentHash": "af6e1cc8cd72d40c4515e9af777b6ae2a19488d2f78ab92ac4b13ed1683e8ca9", | ||
| "typeScriptVersion": "2.8" | ||
| } |
+2
-2
@@ -5,3 +5,3 @@ # Installation | ||
| # Summary | ||
| This package contains type definitions for wouter ( https://github.com/molefrog/wouter#readme ). | ||
| This package contains type definitions for wouter (https://github.com/molefrog/wouter#readme). | ||
@@ -12,3 +12,3 @@ # Details | ||
| Additional Details | ||
| * Last updated: Tue, 14 May 2019 21:56:57 GMT | ||
| * Last updated: Fri, 21 Jun 2019 00:47:44 GMT | ||
| * Dependencies: @types/react | ||
@@ -15,0 +15,0 @@ * Global values: none |
4563
11.89%7
75%67
42.55%