From 052f63219a133f52e15790b69365c420068677dc Mon Sep 17 00:00:00 2001 From: Egor Blinov Date: Thu, 23 May 2019 18:50:01 +0300 Subject: [PATCH] fix super type parameters --- src/__testfixtures__/flow-comments.input.js | 7 +++++++ src/__testfixtures__/flow-comments.output.js | 7 +++++++ src/flow-comments.ts | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/src/__testfixtures__/flow-comments.input.js b/src/__testfixtures__/flow-comments.input.js index 4cabc13..23fdafb 100644 --- a/src/__testfixtures__/flow-comments.input.js +++ b/src/__testfixtures__/flow-comments.input.js @@ -98,6 +98,13 @@ class C4 implements TestInterface { interfaceMethod(value: string): void {}; } +// class extends with generic +class C5 extends Component { + render() { + return null; + } +} + // simple type cast var e = (d: number); diff --git a/src/__testfixtures__/flow-comments.output.js b/src/__testfixtures__/flow-comments.output.js index 6389f11..e035c93 100644 --- a/src/__testfixtures__/flow-comments.output.js +++ b/src/__testfixtures__/flow-comments.output.js @@ -104,6 +104,13 @@ class C4/*:: */ /*:: implements TestInterface*/ interfaceMethod(value/*: string*/)/*: void*/ {} } +// class extends with generic +class C5 extends Component/*:: */ { + render() { + return null; + } +} + // simple type cast var e = ((d/*: number*/)); diff --git a/src/flow-comments.ts b/src/flow-comments.ts index cfbd5d2..c3e9f24 100644 --- a/src/flow-comments.ts +++ b/src/flow-comments.ts @@ -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);