Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: previous type annotation is not replaced #2018

Open
pjonsson opened this issue Nov 30, 2024 · 1 comment
Open

Bug: previous type annotation is not replaced #2018

pjonsson opened this issue Nov 30, 2024 · 1 comment
Labels
area: fixers Around how TypeStat fixes code. status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛

Comments

@pjonsson
Copy link
Contributor

🐛 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.

@JoshuaKGoldberg JoshuaKGoldberg added type: bug Something isn't working :( 🐛 status: accepting prs Please, send a pull request to resolve this! 🙏 area: fixers Around how TypeStat fixes code. labels Nov 30, 2024
@pjonsson
Copy link
Contributor Author

pjonsson commented Dec 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: fixers Around how TypeStat fixes code. status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛
Projects
None yet
Development

No branches or pull requests

2 participants