-
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
erroneous "is specified more than once, so this usage will be overwritten.(2783)" #39671
Comments
yes, there are multiple related issues, including some apparently fixed ones; problem is, they usually have an additional quirk, which is often the part that gets fixed; I tried to reduce our issue to a small example with nothing extra, so it is not a duplicate of any of the listed issues. There may well be a common root to several of the related issues, and there are sufficiently many related issues that a collective tracking issue may be in order. |
The real duplicate here is #13778 since the fix is to include |
while that is a more interesting discussion (I'm only halfway through at this point) that clarifies some of the goals that led to the current situation, neither the fix nor the problem are quite as simple. In the real-world code, we reconstruct a tree from a flat database representation, and we know that the order in which the code accesses the tree while the tree is being build is correct. We just find it difficult to convince typescript's CFA of this fact. I've extended the playground example a bit in the hope of illustrating the effect: Playground Link
Is our only option to disable typechecking here? |
okay, while thinking some more about #13778 and about how the example still doesn't quite represent our problem, I was able to come up with a way to explain to typescript what is happening. For others finding this issue:
slightly extended example: Playground Link Note
I'm still on the fence whether the change from 3.8.3 to 3.9.2 was positive or negative in general. For this example:
|
The use of the spread opertor causes issues in TypeScript 3.9.x To avoid this issue we use Object.assign to return on object with default values. TypeScript error: error TS2783: '<XYZ>' is specified more than once, so this usage will be overwritten. See Travis build with errors: https://travis-ci.org/github/joule-labs/joule-extension/builds/713053315 Related TypeScript issues: microsoft/TypeScript#39671 microsoft/TypeScript#38535
TypeScript Version: 3.9.2, also in 4.0.0-beta (not in 3.8.3)
Search Terms:
2783
Expected behavior:
code should be accepted without error
Actual behavior:
error 2783 ist raised
Related Issues:
#38535, #39113, #36779, #37740
Code
(the actual code builds
obj
in a loop, but this small example shows the issue; btw, if you delete thex: 0,
, there is no error, which is also not correct)Output
Compiler Options
Playground Link: Provided
potentially relevant: https://stackoverflow.com/questions/47155141/spreading-undefined-in-array-vs-object
The text was updated successfully, but these errors were encountered: