-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[react] createElement for AbstractComponent
Summary: This implements createElement for AbstractComponent. The implementation here is a bit hacky, since we already have access to the config. I explain this in a comment inline. The reason I didn't just rewrite this entire function to use get_config and then compare the incoming config object with the config type is because there is some special handling we have for children, keys, and ref that is handled in `object_kit`. That said, this is something that I want to refactor in the future. Reviewed By: samwgoldman Differential Revision: D13221333 fbshipit-source-id: a41e86a4769abf21006d352909cbab4dddb05fa8
- Loading branch information
1 parent
65b550f
commit 4528c07
Showing
3 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@flow | ||
|
||
const React = require('react'); | ||
|
||
declare var C: React$AbstractComponent<{+foo?: number, +bar: number | string, +baz: number}, mixed, number>; | ||
|
||
const _a = <C foo={3} bar="string" baz={4} />; | ||
const _b = <C bar={3} baz={4} />; | ||
const _c = <C baz={4} />; // Error missing bar | ||
const _d = <C bar={3} />; // Error missing baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters