fix defaults on type annotated arrow function params - fixes #2493
This commit is contained in:
@@ -762,6 +762,16 @@ export default function (instance) {
|
||||
return node.expression;
|
||||
}
|
||||
|
||||
instance.extend("toAssignable", function (inner) {
|
||||
return function (node) {
|
||||
if (node.type === "TypeCastExpression") {
|
||||
return typeCastToParameter(node);
|
||||
} else {
|
||||
return inner.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// turn type casts that we found in function parameter head into type annotated params
|
||||
instance.extend("toAssignableList", function (inner) {
|
||||
return function (exprList, isBinding) {
|
||||
@@ -807,6 +817,14 @@ export default function (instance) {
|
||||
};
|
||||
});
|
||||
|
||||
instance.extend("checkLVal", function (inner) {
|
||||
return function (node) {
|
||||
if (node.type !== "TypeCastExpression") {
|
||||
return inner.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// parse class property type annotations
|
||||
instance.extend("parseClassProperty", function (inner) {
|
||||
return function (node) {
|
||||
|
||||
Reference in New Issue
Block a user