Socket
Socket
Sign inDemoInstall

@types/prop-types

Package Overview
Dependencies
2
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 15.5.3 to 15.5.4

59

prop-types/index.d.ts
// Type definitions for prop-types 15.5
// Project: https://github.com/reactjs/prop-types
// Definitions by: DovydasNavickas <https://github.com/DovydasNavickas>
// Ferdy Budhidharma <https://github.com/ferdaber>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.8
export type Validator<T> = (object: T, key: string, componentName: string, ...rest: any[]) => Error | null;
import { ReactNode, ReactElement } from 'react';
export interface Requireable<T> extends Validator<T> {
isRequired: Validator<T>;
export const nominalTypeHack: unique symbol;
export type IsOptional<T> = undefined | null extends T ? true : undefined extends T ? true : null extends T ? true : false;
export type RequiredKeys<V> = { [K in keyof V]: V[K] extends Validator<infer T> ? IsOptional<T> extends true ? never : K : never }[keyof V];
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;
[nominalTypeHack]?: T;
}
export type ValidationMap<T> = {[K in keyof T]?: Validator<T> };
export interface Requireable<T> extends Validator<T | undefined | null> {
isRequired: Validator<NonNullable<T>>;
}
export type ValidationMap<T> = { [K in keyof T]-?: Validator<T[K]> };
export type InferType<V> = V extends Validator<infer T> ? T : any;
export type InferProps<V> =
& InferPropsInner<Pick<V, RequiredKeys<V>>>
& Partial<InferPropsInner<Pick<V, OptionalKeys<V>>>>;
export const any: Requireable<any>;
export const array: Requireable<any>;
export const bool: Requireable<any>;
export const func: Requireable<any>;
export const number: Requireable<any>;
export const object: Requireable<any>;
export const string: Requireable<any>;
export const node: Requireable<any>;
export const element: Requireable<any>;
export const symbol: Requireable<any>;
export function instanceOf(expectedClass: {}): Requireable<any>;
export function oneOf(types: any[]): Requireable<any>;
export function oneOfType(types: Array<Validator<any>>): Requireable<any>;
export function arrayOf(type: Validator<any>): Requireable<any>;
export function objectOf(type: Validator<any>): Requireable<any>;
export function shape(type: ValidationMap<any>): Requireable<any>;
export const array: Requireable<any[]>;
export const bool: Requireable<boolean>;
export const func: Requireable<(...args: any[]) => any>;
export const number: Requireable<number>;
export const object: Requireable<object>;
export const string: Requireable<string>;
export const node: Requireable<ReactNode>;
export const element: Requireable<ReactElement<any>>;
export const symbol: Requireable<symbol>;
export function instanceOf<T>(expectedClass: new (...args: any[]) => T): Requireable<T>;
export function oneOf<T>(types: T[]): Requireable<T>;
export function oneOfType<T extends Validator<any>>(types: T[]): Requireable<NonNullable<InferType<T>>>;
export function arrayOf<T>(type: Validator<T>): Requireable<T[]>;
export function objectOf<T>(type: Validator<T>): Requireable<{ [K in keyof any]: T; }>;
export function shape<P extends ValidationMap<any>>(type: P): Requireable<InferProps<P>>;

@@ -32,0 +51,0 @@ /**

{
"name": "@types/prop-types",
"version": "15.5.3",
"version": "15.5.4",
"description": "TypeScript definitions for prop-types",

@@ -11,2 +11,7 @@ "license": "MIT",

"githubUsername": "DovydasNavickas"
},
{
"name": "Ferdy Budhidharma",
"url": "https://github.com/ferdaber",
"githubUsername": "ferdaber"
}

@@ -17,8 +22,10 @@ ],

"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git.git"
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "c3d2dc452a5a81f10532428317a08162159119681bf0543ccda9cf3bda43bada",
"typeScriptVersion": "2.2"
"dependencies": {
"@types/react": "*"
},
"typesPublisherContentHash": "3f2a00ce692f5e64991478bbaf3709dab1272f09ccbfa7e397093739ee3e12bd",
"typeScriptVersion": "2.8"
}

@@ -8,10 +8,10 @@ # Installation

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped.git/tree/master/types/prop-types
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prop-types
Additional Details
* Last updated: Fri, 18 May 2018 20:19:36 GMT
* Dependencies: none
* Last updated: Mon, 23 Jul 2018 23:44:12 GMT
* Dependencies: react
* Global values: none
# Credits
These definitions were written by DovydasNavickas <https://github.com/DovydasNavickas>.
These definitions were written by DovydasNavickas <https://github.com/DovydasNavickas>, Ferdy Budhidharma <https://github.com/ferdaber>.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc