Skip to content

Commit

Permalink
fix super type parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
escaton committed May 23, 2019
1 parent 6c5ac19 commit 052f632
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/__testfixtures__/flow-comments.input.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ class C4<T> implements TestInterface {
interfaceMethod(value: string): void {};
}

// class extends with generic
class C5 extends Component<Props> {
render() {
return null;
}
}

// simple type cast
var e = (d: number);

Expand Down
7 changes: 7 additions & 0 deletions src/__testfixtures__/flow-comments.output.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ class C4/*:: <T>*/ /*:: implements TestInterface*/
interfaceMethod(value/*: string*/)/*: void*/ {}
}

// class extends with generic
class C5 extends Component/*:: <Props>*/ {
render() {
return null;
}
}

// simple type cast
var e = ((d/*: number*/));

Expand Down
4 changes: 4 additions & 0 deletions src/flow-comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ function flow2comments(file: jscodeshift.FileInfo, api: jscodeshift.API): string
.find(j.TypeParameterDeclaration)
.replaceWith(flowBlockComment);

root
.find(j.TypeParameterInstantiation)
.replaceWith(flowBlockComment);

root
.find(j.OpaqueType)
.replaceWith(flowBlockComment);
Expand Down

0 comments on commit 052f632

Please sign in to comment.