Skip to content

Inline propTypes checking code#15

Merged
NMinhNguyen merged 1 commit into
masterfrom
inline-pt
Feb 28, 2020
Merged

Inline propTypes checking code#15
NMinhNguyen merged 1 commit into
masterfrom
inline-pt

Conversation

@gaearon

@gaearon gaearon commented Feb 28, 2020

Copy link
Copy Markdown
Collaborator

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 (react/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
Copy Markdown
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