From 7d4eaef72015bc7c9ddea3be22e67d96aaafb989 Mon Sep 17 00:00:00 2001 From: Andrew Huth Date: Thu, 4 Apr 2019 14:08:34 -0700 Subject: [PATCH] Add type for new "ref" airbnb-prop-type --- types/airbnb-prop-types/airbnb-prop-types-tests.ts | 3 +++ types/airbnb-prop-types/index.d.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/types/airbnb-prop-types/airbnb-prop-types-tests.ts b/types/airbnb-prop-types/airbnb-prop-types-tests.ts index 9272fe6ddc..89ce170970 100644 --- a/types/airbnb-prop-types/airbnb-prop-types-tests.ts +++ b/types/airbnb-prop-types/airbnb-prop-types-tests.ts @@ -152,6 +152,9 @@ AirbnbPropTypes.range(0, 10); // $ExpectType Requireable<5> AirbnbPropTypes.range<5>(0, 10); +// $ExpectType Requireable> +AirbnbPropTypes.ref(); + // $ExpectType Requireable AirbnbPropTypes.requiredBy('foo', PropTypes.string); // $ExpectType Validator diff --git a/types/airbnb-prop-types/index.d.ts b/types/airbnb-prop-types/index.d.ts index 10c58556c7..09902068b3 100644 --- a/types/airbnb-prop-types/index.d.ts +++ b/types/airbnb-prop-types/index.d.ts @@ -5,6 +5,7 @@ // TypeScript Version: 3.0 import * as PropTypes from 'prop-types'; +import * as React from 'react'; export interface ReactComponentLike { setState(...args: any[]): any; @@ -156,6 +157,8 @@ 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 requiredBy

( requiredByPropName: string, propType: PropTypes.Validator

,