Infer type assertions for object

Cross-ports https://github.com/mapbox/mapbox-gl-js/pull/6243.
This commit is contained in:
John Firebaugh
2018-02-28 15:03:47 -08:00
parent d5829d0d00
commit 15ba70b5ff

View File

@@ -147,7 +147,7 @@ ParseResult ParsingContext::parse(const Convertible& value, TypeAnnotationOption
};
const type::Type actual = (*parsed)->getType();
if ((*expected == type::String || *expected == type::Number || *expected == type::Boolean) && actual == type::Value) {
if ((*expected == type::String || *expected == type::Number || *expected == type::Boolean || *expected == type::Object) && actual == type::Value) {
if (typeAnnotationOption == includeTypeAnnotations) {
parsed = { std::make_unique<Assertion>(*expected, array(std::move(*parsed))) };
}