-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Computed properties no throws if there is a duplicate #25758
Comments
Checking for duplicate declaration errors are done earlier in the process, by the time the compiler known the properties it is a bit late to report the errors |
This is very sad sometimes it works, from time to time const A = 'a';
const x = {[A]: 1, [A]() {}} // Duplicate declaration '[A]' |
👍 This one is rather annoying for me personally, looking forward to a fix. |
any hacky solution for this? |
found one, for now I will replace
|
I explored the various cases where this occurs. I've recorded the actual errors received in each case. This was in VSCode, with TypeScript 4.4.2.
|
It would be ideal if all of the above cases gave the same errors, rather than mixing and matching the four different errors across the different cases. My personal preference would be for three errors in every case:
In addition to the bug where some duplicated property names show no error at all, I believe that the following cases are also bugs:
|
TypeScript Version: 3.0.0-dev.20180712
Search Terms:
Code
Expected behavior:
Duplicate declaration error
Actual behavior:
No error
Playground Link: https://www.typescriptlang.org/play/#src=const%20A%20%3D%20'a'%3B%0D%0Aconst%20x%20%3D%20%7B%5BA%5D%3A%201%2C%20%5BA%5D%3A%201%7D%0D%0A
Related Issues:
The text was updated successfully, but these errors were encountered: