Socket
Socket
Sign inDemoInstall

@traveloka/prop-types

Package Overview
Dependencies
0
Maintainers
11
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @traveloka/prop-types

[![CircleCI](https://circleci.com/gh/traveloka/prop-types.svg?style=svg)](https://circleci.com/gh/traveloka/prop-types) [![codecov](https://codecov.io/gh/traveloka/prop-types/branch/master/graph/badge.svg)](https://codecov.io/gh/traveloka/prop-types)


Version published
Maintainers
11
Install size
6.16 kB
Created

Readme

Source

prop-types

CircleCI codecov

Custom prop-types used in Traveloka project for react prop validation that can't be covered using compile-time typecheck (such as Flow/Typescript)

API

ElementWithProps

Used to validate certain prop to equal react element with predefined props

Example:

import { ElementWithProps } from '@traveloka/prop-types';

const B = () => null;
const A = () => null;

A.propTypes = {
  b: ElementWithProps(B, { x: 'y', other: PropTypes.string })
}

// fail
<A b={<B />} />
<A b={<B x='x' />} />
<A b={<B y='x' />} />

// pass
<A b={<B x='y' />} />
<A b={<B x='y' other='any' />} />

LICENSE

MIT

FAQs

Last updated on 19 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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