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
Weekly downloads
19M
increased by2.31%
Maintainers
1
Install size
6.66 kB
Created
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: Fri, 07 Dec 2018 21:50:02 GMT
  • Dependencies: none
  • Global values: none

Credits

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

FAQs

Last updated on 07 Dec 2018

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