mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-08 19:20:05 +00:00
Merge pull request #34464 from eps1lon/fix/react-router-dom/ref-objects
[react-router-dom] Allow ref objects in Link.innerRef
This commit is contained in:
3
types/react-router-dom/index.d.ts
vendored
3
types/react-router-dom/index.d.ts
vendored
@@ -4,6 +4,7 @@
|
||||
// Huy Nguyen <https://github.com/huy-nguyen>
|
||||
// Philip Jackson <https://github.com/p-jackson>
|
||||
// John Reilly <https://github.com/johnnyreilly>
|
||||
// Sebastian Silbermann <https://github.com/eps1lon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -47,7 +48,7 @@ export class HashRouter extends React.Component<HashRouterProps, any> {}
|
||||
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||
to: H.LocationDescriptor;
|
||||
replace?: boolean;
|
||||
innerRef?: (node: HTMLAnchorElement | null) => void;
|
||||
innerRef?: React.Ref<HTMLAnchorElement>;
|
||||
}
|
||||
export class Link extends React.Component<LinkProps, any> {}
|
||||
|
||||
|
||||
@@ -39,5 +39,7 @@ const Component: React.SFC<OtherProps> = props => {
|
||||
|
||||
<Link to="/url" />;
|
||||
|
||||
const acceptRef = (node: HTMLAnchorElement | null) => {};
|
||||
<Link to="/url" replace={true} innerRef={acceptRef} />;
|
||||
const refCallback: React.Ref<HTMLAnchorElement> = node => {};
|
||||
<Link to="/url" replace={true} innerRef={refCallback} />;
|
||||
const ref = React.createRef<HTMLAnchorElement>();
|
||||
<Link to="/url" replace={true} innerRef={ref} />;
|
||||
|
||||
Reference in New Issue
Block a user