Skip to content

Commit

Permalink
Reset TypeParameters to Identifier (babel/babel-eslint#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Jun 20, 2016
1 parent c8fe913 commit 93a9a8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions eslint/babel-eslint-parser/babylon-to-espree/toAST.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
3 changes: 2 additions & 1 deletion eslint/babel-eslint-parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
6 changes: 3 additions & 3 deletions eslint/babel-eslint-parser/test/non-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;"
Expand All @@ -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> {}",
Expand Down Expand Up @@ -786,7 +786,7 @@ describe("verify", function () {
);
});

it.skip("32", function () {
it("32", function () {
verifyAndAssertMessages(
[
"import type Foo from 'foo';",
Expand Down

0 comments on commit 93a9a8d

Please sign in to comment.