mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[@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:
parent
48e407db01
commit
70ea755232
2
types/prop-types/index.d.ts
vendored
2
types/prop-types/index.d.ts
vendored
@ -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;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user