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: missing semi-colon after object member #2017

Open
pjonsson opened this issue Nov 29, 2024 · 3 comments
Open

Bug: missing semi-colon after object member #2017

pjonsson opened this issue Nov 29, 2024 · 3 comments
Labels
area: fixers Around how TypeStat fixes code. area: react Related to JSX syntax, particularly for React components and the like. 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/Custom/Chart/ChartPanelDownloadButton.tsx b/lib/ReactViews/Custom/Chart/ChartPanelDownloadButton.tsx
index 20bb45d24..ba40adf73 100644
--- a/lib/ReactViews/Custom/Chart/ChartPanelDownloadButton.tsx
+++ b/lib/ReactViews/Custom/Chart/ChartPanelDownloadButton.tsx
@@ -86,7 +86,15 @@ async function download(items: TableMixin.Instance[]) {
 }

 export const ChartPanelDownloadButton = observer(
-  (props: { chartableItems: ChartableMixin.Instance[] }) => {
+  (props: { chartableItems: ChartableMixin.Instance[] key: string;
+catalogItem: MappableMixin.Instance;
+features: TerriaFeature[];
+onToggleOpen: (feature: TerriaFeature) => void;
+viewState: ViewState;
+item: CatalogMemberMixin.Instance;
+removable: boolean;
+terria: Terria;
+}) => {
     // For the moment we only support TableMixin items
     const tableItems = props.chartableItems.filter(TableMixin.isMixedInto);

Expected Behavior

Just looking at the output, I would guess that TypeStat forgets to add a semi-colon and/or newline after the single member of the object when there isn't one, and proceeds to output its discovered additional members.

Reproduction

Same as #2014.

@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Please, send a pull request to resolve this! 🙏 area: react Related to JSX syntax, particularly for React components and the like. area: fixers Around how TypeStat fixes code. type: bug Something isn't working :( 🐛 labels Nov 30, 2024
@rubiesonthesky
Copy link
Collaborator

I'm not very familiar with React, but are these added props even correct otherwise? I can't see that they would have been referenced in that component.

@pjonsson
Copy link
Contributor Author

pjonsson commented Dec 7, 2024

I filed this bug because of the syntax error in the output. It's quite possible the result is wrong as well, but I think that kind of bug will be easier to find after this bug is fixed since one can just run TypeStat on various projects and then compile the result and see if tsc complains about type errors.

@rubiesonthesky
Copy link
Collaborator

Yeah that makes sense. I have tried to take some of these smaller chunks and test with these, but then the problem doesn't reproduce. So I fear that the actual problem here is, that the whole system starts to break down when there are multiple files being processed same time and it may be the typechecker and SourceFile are no longer up-to-date. So it's not really a problem about missing semi-colon but it's the tool adding props that should not be added here, and that's why it is adding them to wrong position without semi-colon. I could be of course wrong.

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. area: react Related to JSX syntax, particularly for React components and the like. 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

3 participants