Skip to content

Commit

Permalink
Adds matchOptions to ts types
Browse files Browse the repository at this point in the history
  • Loading branch information
icd2k3 committed Sep 18, 2018
1 parent 305a628 commit 8460819
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

yarn lint && yarn test
yarn lint && yarn types && yarn test
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-breadcrumbs-hoc",
"version": "2.1.4",
"version": "2.1.5",
"description": "Just a tiny, flexible, higher order component for rendering breadcrumbs with react-router 4.x",
"repository": "icd2k3/react-router-breadcrumbs-hoc",
"keywords": [
Expand All @@ -23,8 +23,8 @@
"humanize-string": "^1.0.2"
},
"devDependencies": {
"@types/react": "^16.4.6",
"@types/react-router-dom": "^4.2.7",
"@types/react": "16.4.6",
"@types/react-router-dom": "4.2.7",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
Expand All @@ -44,8 +44,8 @@
"eslint-plugin-react": "^7.10.0",
"jest": "^23.4.0",
"prop-types": "^15.6.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react": "16.4.1",
"react-dom": "16.4.1",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"rollup": "^0.62.0",
Expand Down
7 changes: 7 additions & 0 deletions types/react-router-breadcrumbs-hoc/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ export interface Options {
pathSection?: string;
}

export interface MatchOptions {
exact?: boolean;
strict?: boolean;
sensitive?: boolean;
}

export interface BreadcrumbsRoute {
path: string;
breadcrumb: React.ReactNode | string;
matchOptions?: MatchOptions;
}

export interface BreadcrumbsProps<T = {}> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ const UserBreadcrumb = ({ match }: UserBreadcrumbProps) => (

const routes: BreadcrumbsRoute[] = [
{ path: "/users/:userId", breadcrumb: UserBreadcrumb },
{ path: "/example", breadcrumb: "Custom Example" }
{ path: "/example", breadcrumb: "Custom Example" },
{
path: "/test-match-options",
breadcrumb: "Match Options",
matchOptions: { exact: true, strict: true },
},
];

const Breadcrumbs = ({ breadcrumbs }: InjectedProps) => (
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
version "10.5.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.2.tgz#f19f05314d5421fe37e74153254201a7bf00a707"

"@types/react-router-dom@^4.2.7":
"@types/react-router-dom@4.2.7":
version "4.2.7"
resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-4.2.7.tgz#9d36bfe175f916dd8d7b6b0237feed6cce376b4c"
dependencies:
Expand All @@ -119,7 +119,7 @@
"@types/history" "*"
"@types/react" "*"

"@types/react@*", "@types/react@^16.4.6":
"@types/react@*", "@types/react@16.4.6":
version "16.4.6"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.6.tgz#5024957c6bcef4f02823accf5974faba2e54fada"
dependencies:
Expand Down Expand Up @@ -3903,7 +3903,7 @@ rc@^1.2.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

react-dom@^16.4.1:
react-dom@16.4.1:
version "16.4.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.1.tgz#7f8b0223b3a5fbe205116c56deb85de32685dad6"
dependencies:
Expand Down Expand Up @@ -3957,7 +3957,7 @@ react-test-renderer@^16.0.0-0:
prop-types "^15.6.0"
react-is "^16.4.1"

react@^16.4.1:
react@16.4.1:
version "16.4.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.4.1.tgz#de51ba5764b5dbcd1f9079037b862bd26b82fe32"
dependencies:
Expand Down

0 comments on commit 8460819

Please sign in to comment.