Socket
Socket
Sign inDemoInstall

@types/prop-types

Package Overview
Dependencies
0
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/prop-types

TypeScript definitions for prop-types


Version published
Maintainers
1
Weekly downloads
18,511,388
decreased by-6.37%

Weekly downloads

Package description

What is @types/prop-types?

The @types/prop-types package is a TypeScript declaration package that provides type definitions for the prop-types library, which is used for runtime type checking of React props. It allows developers to use prop-types in TypeScript projects and get type checking and IntelliSense support in their code editors.

What are @types/prop-types's main functionalities?

Type checking for React props

This feature allows developers to define type checking for the props of a React component. The code sample shows how to use PropTypes with TypeScript to ensure that the props passed to a component are of the correct type.

{"import PropTypes from 'prop-types';

interface MyComponentProps {
  name: string;
  age: number;
  isStudent: boolean;
}

const MyComponent: React.FC<MyComponentProps> = ({ name, age, isStudent }) => (
  <div>
    <p>Name: {name}</p>
    <p>Age: {age}</p>
    <p>Is a student: {isStudent ? 'Yes' : 'No'}</p>
  </div>
);

MyComponent.propTypes = {
  name: PropTypes.string.isRequired,
  age: PropTypes.number.isRequired,
  isStudent: PropTypes.bool
};"}

Other packages similar to @types/prop-types

Readme

Source

Installation

npm install --save @types/prop-types

Summary

This package contains type definitions for prop-types ( https://github.com/reactjs/prop-types ).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prop-types

Additional Details

  • Last updated: Wed, 17 Apr 2019 21:01:19 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by DovydasNavickas https://github.com/DovydasNavickas, Ferdy Budhidharma https://github.com/ferdaber, Sebastian Silbermann https://github.com/eps1lon.

FAQs

Last updated on 17 Apr 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