add support for flow type casts and module types

This commit is contained in:
Sebastian McKenzie
2015-02-14 13:22:13 +11:00
parent 1f208a06db
commit 07b6881d67
5 changed files with 21 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ exports.ObjectTypeIndexer =
exports.ObjectTypeProperty =
exports.QualifiedTypeIdentifier =
exports.UnionTypeAnnotation =
exports.TypeCastExpression =
exports.VoidTypeAnnotation = function () {
// todo: implement these once we have a `--keep-types` option
};

View File

@@ -12,6 +12,7 @@ module.exports = {
"playground.objectGetterMemoization": require("./playground/object-getter-memoization"),
reactCompat: require("./other/react-compat"),
flow: require("./other/flow"),
react: require("./other/react"),
_modules: require("./internal/modules"),

View File

@@ -0,0 +1,13 @@
var t = require("../../../types");
exports.TypeCastExpression = function (node) {
return node.expression;
};
exports.ImportDeclaration = function (node) {
if (node.type) this.remove();
};
exports.ExportDeclaration = function (node) {
if (t.isTypeAlias(node.declaration)) this.remove();
};

View File

@@ -92,6 +92,7 @@
"TypeofTypeAnnotation": [],
"TypeAlias": [],
"TypeAnnotation": [],
"TypeCastExpression": ["expression"],
"TypeParameterDeclaration": [],
"TypeParameterInstantiation": [],
"ObjectTypeAnnotation": [],