Reset TypeParameters to Identifier (babel/babel-eslint#325)

This commit is contained in:
Daniel Tschinder 2016-06-20 23:11:38 +02:00
parent c8fe9136d7
commit 93a9a8d638
3 changed files with 11 additions and 4 deletions

View File

@ -167,6 +167,12 @@ var astTransformVisitor = {
node.type = "Experimental" + node.type;
}
if (path.isTypeParameter && path.isTypeParameter()) {
node.type = "Identifier";
node.typeAnnotation = node.bound;
delete node.bound;
}
// flow: prevent "no-undef"
// for "Component" in: "let x: React.Component"
if (path.isQualifiedTypeIdentifier()) {

View File

@ -250,7 +250,8 @@ function monkeypatch() {
this.close(node);
}
};
// visit decorators that are in: Property / MethodDefinition
// visit decorators that are in: Property / MethodDefinition
var visitProperty = referencer.prototype.visitProperty;
referencer.prototype.visitProperty = function(node) {
if (node.value && node.value.type === "TypeCastExpression") {

View File

@ -396,7 +396,7 @@ describe("verify", function () {
);
});
it.skip("polymorphpic/generic types - outside of fn scope #123", function () {
it("polymorphpic/generic types - outside of fn scope #123", function () {
verifyAndAssertMessages([
"export function foo<T>(value) { value; };",
"var b: T = 1; b;"
@ -407,7 +407,7 @@ describe("verify", function () {
);
});
it.skip("polymorphpic/generic types - extending unknown #123", function () {
it("polymorphpic/generic types - extending unknown #123", function () {
verifyAndAssertMessages([
"import Bar from 'bar';",
"export class Foo extends Bar<T> {}",
@ -786,7 +786,7 @@ describe("verify", function () {
);
});
it.skip("32", function () {
it("32", function () {
verifyAndAssertMessages(
[
"import type Foo from 'foo';",