[@types/prop-types] update props type for Validator (#38442)

Custom validators that use the `Validator` type need to be able to
access values out of the `props` object, but currently this fails type
checking. The object of props is keyed by strings, so add this simple
type.
This commit is contained in:
Kyle Getz 2019-09-24 13:11:00 -07:00 committed by Michael Crane
parent 48e407db01
commit 70ea755232

View File

@ -38,7 +38,7 @@ export type OptionalKeys<V> = Exclude<keyof V, RequiredKeys<V>>;
export type InferPropsInner<V> = { [K in keyof V]-?: InferType<V[K]>; };
export interface Validator<T> {
(props: object, propName: string, componentName: string, location: string, propFullName: string): Error | null;
(props: { [key: string]: any }, propName: string, componentName: string, location: string, propFullName: string): Error | null;
[nominalTypeHack]?: {
type: T;
};