From fd991797cd15c8bffea86bc8406f3f027f48d48b Mon Sep 17 00:00:00 2001 From: Philip Jackson Date: Mon, 26 Mar 2018 14:37:03 +1300 Subject: [PATCH] Add `innerRef` prop to component An `innerRef` prop was added to in `react-router-dom@4.2` The node will be an anchor tag, which is why I made the callback accept an `HTMLAnchorElement` rather than an `HTMLElement`, however this isn't explicitly documented. --- types/react-router-dom/index.d.ts | 2 ++ types/react-router-dom/react-router-dom-tests.tsx | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/react-router-dom/index.d.ts b/types/react-router-dom/index.d.ts index c5b795761c..9165f1182e 100644 --- a/types/react-router-dom/index.d.ts +++ b/types/react-router-dom/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ReactTraining/react-router // Definitions by: Tanguy Krotoff // Huy Nguyen +// Philip Jackson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -44,6 +45,7 @@ export class HashRouter extends React.Component {} export interface LinkProps extends React.AnchorHTMLAttributes { to: H.LocationDescriptor; replace?: boolean; + innerRef?: (node: HTMLAnchorElement | null) => void; } export class Link extends React.Component {} diff --git a/types/react-router-dom/react-router-dom-tests.tsx b/types/react-router-dom/react-router-dom-tests.tsx index c748405580..0fedbe412e 100644 --- a/types/react-router-dom/react-router-dom-tests.tsx +++ b/types/react-router-dom/react-router-dom-tests.tsx @@ -2,7 +2,8 @@ import * as React from 'react'; import { NavLink, NavLinkProps, - match + match, + Link } from 'react-router-dom'; import * as H from 'history'; @@ -19,3 +20,8 @@ export default function(props: Props) { ); } + +; + +const acceptRef = (node: HTMLAnchorElement | null) => {}; +;