diff --git a/types/airbnb-prop-types/airbnb-prop-types-tests.ts b/types/airbnb-prop-types/airbnb-prop-types-tests.ts index 89ce170970..cf8535947e 100644 --- a/types/airbnb-prop-types/airbnb-prop-types-tests.ts +++ b/types/airbnb-prop-types/airbnb-prop-types-tests.ts @@ -152,7 +152,7 @@ AirbnbPropTypes.range(0, 10); // $ExpectType Requireable<5> AirbnbPropTypes.range<5>(0, 10); -// $ExpectType Requireable> +// $ExpectType Requireable> AirbnbPropTypes.ref(); // $ExpectType Requireable diff --git a/types/airbnb-prop-types/index.d.ts b/types/airbnb-prop-types/index.d.ts index 1f1b3a8eb5..efab471ef6 100644 --- a/types/airbnb-prop-types/index.d.ts +++ b/types/airbnb-prop-types/index.d.ts @@ -5,7 +5,6 @@ // TypeScript Version: 3.0 import * as PropTypes from 'prop-types'; -import * as React from 'react'; export interface ReactComponentLike { setState(...args: any[]): any; @@ -25,6 +24,12 @@ export type ReactFunctionComponentLike = (...args: any[]) => PropTypes.ReactNode export type ReactTypeLike = string | ReactClassComponentLike | ReactFunctionComponentLike; +export interface ReactRefLike { + readonly current: T | null; +} + +export type ReactLegacyRefLike = (instance: T | null) => void | ReactRefLike | null; + export interface Specifier { max?: number; min?: number; @@ -157,7 +162,7 @@ export function range(min?: number, max?: number): PropTypes.R export function range(min?: number, max?: number): PropTypes.Requireable; -export function ref(): PropTypes.Requireable>; +export function ref(): PropTypes.Requireable>; export function requiredBy

( requiredByPropName: string,