Comments (2)
use type Facebook\XHP\HTML\div;
function test(): void {
$x = <div>{null}</div>;
}
This should be equivalent to <div></div>
. Instead:
Typing[4110] Some elements in this collection are incompatible [1]
-> Expected XHPChild [2]
-> But got null [3]
src/test.hack:4:8
2 |
3 | function test(): void {
[1,3] 4 | $x = <div>{null}</div>;
5 | }
vendor/facebook/xhp-lib/src/core/Node.hack:52:17
50 | final public function __construct(
51 | KeyedTraversable<string, mixed> $attributes,
[2] 52 | Traversable<\XHPChild> $children,
53 | dynamic ...$debug_info
54 | ) {
from xhp-lib.
Yep I included this as a breaking change in the release notes:
The typechecker now checks XHP constructor calls (bad calls would previously result in a runtime error, but wouldn’t be caught by the typechecker). This may reveal new errors, but it should be rare, since XHP class declarations rarely override the built-in default constructor, and are usually instantiated using the standard XHP syntax instead of explicit constructor calls.
Of course, whenever someone declares a bug to be rare, it will immediately happen.
Fixed in both v4 and v3, also tagged a release of each since it was blocking updating the docs site and other projects.
(also includes a test case)
from xhp-lib.
Related Issues (20)
- Remove XHPRoot, seal `x:node`/composable-element to x:primitive and x:element HOT 5
- [ Todo ] When XHP version 4 is released, update the docs about runtime validation in user-documentation. HOT 2
- Remove class2element/element2class
- Audit all code that is not in namespaces HOT 1
- Do we want the HTML xhp classes to be final in v4?
- [ RFC ] Introduce a new exception class for modifying/rendering xhp after initial render HOT 1
- Remove string selectors from getFirstChild and friends
- Audit missing category declarations HOT 4
- Rewrite docs on user-documentation to use xhp 4 syntax and rules HOT 2
- Make a full list of changes from v3
- Write a migration guide for v3 -> v4
- better exception message when rendering parent with an already rendered child HOT 8
- Review and consider removing all 'deprecated' features HOT 1
- Update README to reflect xhp-4
- Class Undefined xhp-lib v3 HOT 9
- Use of XHP at Facebook HOT 2
- Default values of aria- and data- attributes are ignored
- [Request] Custom special attributes HOT 4
- Status of the project HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xhp-lib.