From ee05115ac7da202bdaba5dba87092ebce7670568 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Mon, 21 May 2018 13:45:15 -0700 Subject: [PATCH] Reactstrap: update types for innerRefs. Refer to React's Ref class instead. This way the types of the innerRef reflect whatever the installed typings for React say a ref can be. --- types/reactstrap/lib/Button.d.ts | 2 +- types/reactstrap/lib/CardLink.d.ts | 2 +- types/reactstrap/lib/Form.d.ts | 2 +- types/reactstrap/lib/Input.d.ts | 2 +- types/reactstrap/lib/NavLink.d.ts | 2 +- types/reactstrap/reactstrap-tests.tsx | 13 +++++++++++-- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index de1e92482f..bf75bcec8e 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -8,7 +8,7 @@ export interface ButtonProps extends React.HTMLProps { color?: string; disabled?: boolean; tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; onClick?: React.MouseEventHandler; size?: any; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 9425571de5..1a24b55658 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -2,7 +2,7 @@ import { CSSModule } from '../index'; export interface CardLinkProps extends React.HTMLAttributes { tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; className?: string; cssModule?: CSSModule; href?: string; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index 534a5d3988..3b6f846d08 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -4,7 +4,7 @@ import { CSSModule } from '../index'; export interface FormProps extends React.HTMLProps { inline?: boolean; tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; className?: string; cssModule?: CSSModule; } diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index eddd8089be..9d160ec2c4 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -35,7 +35,7 @@ export interface InputProps extends React.InputHTMLAttributes valid?: boolean; invalid?: boolean; tag?: React.ReactType; - innerRef?: string | ((instance: HTMLInputElement) => any); + innerRef?: React.Ref; plaintext?: boolean; addon?: boolean; className?: string; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 9625f92bc9..0fdfdec641 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -3,7 +3,7 @@ import { CSSModule } from '../index'; export interface NavLinkProps extends React.HTMLProps { tag?: React.ReactType; - innerRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: React.Ref; disabled?: boolean; active?: boolean; className?: string; diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 6f922a6dd4..959ac2658b 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -3336,7 +3336,7 @@ const CSSModuleExample = (props: any) => { }; class Example107 extends React.Component { - private input: HTMLInputElement; + private input: HTMLInputElement | null; render() { return { this.input = input; }} />; @@ -3694,7 +3694,6 @@ const Example116 = (props: any) => { function Example117() { const ref = (e: any) => {}; - ;