TypeStat icon indicating copy to clipboard operation
TypeStat copied to clipboard

Bug: missing semi-colon after object member

Open pjonsson opened this issue 1 year ago • 3 comments

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

pjonsson avatar Nov 29 '24 23:11 pjonsson

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.

rubiesonthesky avatar Dec 06 '24 23:12 rubiesonthesky

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.

pjonsson avatar Dec 07 '24 10:12 pjonsson

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.

rubiesonthesky avatar Dec 07 '24 22:12 rubiesonthesky