add support for flow type casts and module types
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
@@ -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"),
|
||||
|
||||
13
lib/6to5/transformation/transformers/other/flow.js
Normal file
13
lib/6to5/transformation/transformers/other/flow.js
Normal 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();
|
||||
};
|
||||
@@ -92,6 +92,7 @@
|
||||
"TypeofTypeAnnotation": [],
|
||||
"TypeAlias": [],
|
||||
"TypeAnnotation": [],
|
||||
"TypeCastExpression": ["expression"],
|
||||
"TypeParameterDeclaration": [],
|
||||
"TypeParameterInstantiation": [],
|
||||
"ObjectTypeAnnotation": [],
|
||||
|
||||
Reference in New Issue
Block a user