Skip to content

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Feb 28, 2020

The propTypes checking contract hasn't changed for years. It's stable.

Its source of truth lives in the prop-types package. However, we are inlining it in the React repo (facebook/react#18127) to simplify React's ES Modules adoption story. We will do the same with the Object.assign polyfill. This PR mirrors the same change for the shallow renderer, too.

The goal is to get to a place where none of our transitive dependencies require CommonJS for bundling.

The other change here is that I reuse the existing React's mechanism for injecting the stack. Previously, shallow renderer did a special thing, which only worked for propTypes. Now we use a generic mechanism so if you call, for example, React.createElement, it will also get the right stack.

Easier to review without whitespace: https://github.com/NMinhNguyen/react-shallow-renderer/compare/inline-pt?w=1

@NMinhNguyen NMinhNguyen merged commit 2e59ba1 into master Feb 28, 2020
@NMinhNguyen NMinhNguyen deleted the inline-pt branch February 28, 2020 02:51
@NMinhNguyen
Copy link
Collaborator

This is great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants