Reset TypeParameters to Identifier (babel/babel-eslint#325)
This commit is contained in:
parent
c8fe9136d7
commit
93a9a8d638
@ -167,6 +167,12 @@ var astTransformVisitor = {
|
|||||||
node.type = "Experimental" + node.type;
|
node.type = "Experimental" + node.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path.isTypeParameter && path.isTypeParameter()) {
|
||||||
|
node.type = "Identifier";
|
||||||
|
node.typeAnnotation = node.bound;
|
||||||
|
delete node.bound;
|
||||||
|
}
|
||||||
|
|
||||||
// flow: prevent "no-undef"
|
// flow: prevent "no-undef"
|
||||||
// for "Component" in: "let x: React.Component"
|
// for "Component" in: "let x: React.Component"
|
||||||
if (path.isQualifiedTypeIdentifier()) {
|
if (path.isQualifiedTypeIdentifier()) {
|
||||||
|
|||||||
@ -250,6 +250,7 @@ function monkeypatch() {
|
|||||||
this.close(node);
|
this.close(node);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// visit decorators that are in: Property / MethodDefinition
|
// visit decorators that are in: Property / MethodDefinition
|
||||||
var visitProperty = referencer.prototype.visitProperty;
|
var visitProperty = referencer.prototype.visitProperty;
|
||||||
referencer.prototype.visitProperty = function(node) {
|
referencer.prototype.visitProperty = function(node) {
|
||||||
|
|||||||
@ -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([
|
verifyAndAssertMessages([
|
||||||
"export function foo<T>(value) { value; };",
|
"export function foo<T>(value) { value; };",
|
||||||
"var b: T = 1; b;"
|
"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([
|
verifyAndAssertMessages([
|
||||||
"import Bar from 'bar';",
|
"import Bar from 'bar';",
|
||||||
"export class Foo extends Bar<T> {}",
|
"export class Foo extends Bar<T> {}",
|
||||||
@ -786,7 +786,7 @@ describe("verify", function () {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip("32", function () {
|
it("32", function () {
|
||||||
verifyAndAssertMessages(
|
verifyAndAssertMessages(
|
||||||
[
|
[
|
||||||
"import type Foo from 'foo';",
|
"import type Foo from 'foo';",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user