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: Using missingProperties with private class properties broken #2183

Open
3 tasks done
rubiesonthesky opened this issue Feb 2, 2025 · 2 comments
Open
3 tasks done
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛

Comments

@rubiesonthesky
Copy link
Collaborator

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

	class WaveTracker {
		#previouslySeen = new Set<string>();

		#repeatedCount = 0;

		addAndCheck() {
			this.#repeatedCount = 0;
		}
	}

or

	class WaveTracker {
		#previouslySeen = new Set<string>();

		#repeatedCount: number = 0;

		addAndCheck() {
			this.#repeatedCount = 0;
		}
	}

Actual

class WaveTracker {
		#previouslySeen = new Set<string>();

		#repeatedCount = 0;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;
#repeatedCount: number;

		addAndCheck() {
			this.#repeatedCount = 0;
		}
	}

Additional Info

This can be reproduced by adding below code to missingPropertyAccess test.

class WaveTracker {
		#previouslySeen = new Set<string>();

		#repeatedCount = 0;

		addAndCheck() {
			this.#repeatedCount = 0;
		}
	}
@rubiesonthesky rubiesonthesky added the type: bug Something isn't working :( 🐛 label Feb 2, 2025
@rubiesonthesky
Copy link
Collaborator Author

By adding new check to getMissingPropertyMutations, this can be fixed. Though I'm unsure if the fix would be correct

export const getMissingPropertyMutations = (
	request: FileMutationsRequest,
	node: ts.PropertyAccessExpression,
): Mutation | undefined => {
   // ...
   if (ts.isPrivateIdentifier(node.name)) {
       return undefined;
    }
    //...
}

@JoshuaKGoldberg JoshuaKGoldberg added the status: accepting prs Please, send a pull request to resolve this! 🙏 label Feb 6, 2025
@JoshuaKGoldberg
Copy link
Owner

Can't hurt to try it out 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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