Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Reset TypeParameters to Identifier #325

Merged
merged 1 commit into from
Jun 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions 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 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 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