finds.dev← search

// the find

ljharb/prop-types-exact

★ 237 · JavaScript · MIT · updated Apr 2026

For use with React PropTypes. Will error on any prop not explicitly specified.

A small helper that wraps a React propTypes object and warns in development when a component receives a prop it did not declare. It is for teams on PropTypes who want typos and stale props to show up in the console instead of passing silently.

The public surface is one function that takes one object, so there is little to learn or misuse. The package ships a separate sloppy entry point with its own test file, which suggests the author treats lenient and strict validation as two deliberate contracts rather than a flag. The test directory includes a helper named _failTestsOnErrors, which appears to make unexpected PropTypes warnings fail the suite instead of printing quietly. That is the right default for a library whose entire output is console warnings. It is maintained by ljharb, with a push as recent as April 2026 and CI badges, which matters for a package that sits inside other people's dependency trees.

React 19 stopped checking propTypes on function components, which is the form the README example uses, so on current React this does nothing unless you call the validator yourself. The README does not mention that. Even where it works, the check only runs in development because React strips PropTypes checks from production builds, so it is a development tripwire rather than a guarantee at the boundary. The README documents only the strict form and never mentions the sloppy entry point that ships in src/, so a reader cannot tell when to choose it. A TypeScript project gets the same check at compile time, which makes this mainly relevant to codebases that are still on PropTypes.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →