TypeStat icon indicating copy to clipboard operation
TypeStat copied to clipboard

Bug: previous type annotation is not replaced

Open pjonsson opened this issue 1 year ago • 1 comments

🐛 Bug Report

  • TypeStat version: 0.8.1
  • TypeScript version: 5.2
  • Node version: 20

Actual Behavior

diff --git a/lib/ReactViews/Tools/DiffTool/DiffTool.tsx b/lib/ReactViews/Tools/DiffTool/DiffTool.tsx
index 79c9e6e0c..f52735a8b 100644
--- a/lib/ReactViews/Tools/DiffTool/DiffTool.tsx
+++ b/lib/ReactViews/Tools/DiffTool/DiffTool.tsx
@@ -890,7 +890,7 @@ const Selector = (props: any) => (

 const AreaFilterSelection = (props: {
   t: TFunction;
-  location?: LatLonHeight;
+  location?: LatLonHeight | number;
   isPickingNewLocation: boolean;
   theme?: any;
 }) => {
@@ -969,7 +969,12 @@ const LocationAndDatesDisplayBox = styled(Box).attrs({
   }
 `;

-const LegendImage = function (props: any) {
+interface LegendImageProps {
+width: string;
+src: string;
+}
+
+const LegendImage = function (props: any: LegendImageProps) {
   return (
     <img
       {...props}

Expected Behavior

I would expect const LegendImage = function (props: any) { to become const LegendImage = function (props: LegendImageProps) {.

Reproduction

Same as #2014.

pjonsson avatar Nov 30 '24 00:11 pjonsson

I just tried ts-fix and that also misplaced some return type annotations in a similar fashion. I'm guessing the cause is some underlying bug with the line/column start/end information for some tokens.

pjonsson avatar Dec 03 '24 01:12 pjonsson