You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: Expected type to be "Array<Json>", but got "Array<Json>" instead
--> main.w:3:13
|
3 | base.concat(extra.copy());
| ^^^^^^^^^^ Expected type to be "Array<Json>", but got "Array<Json>" instead
I expected this:
No error
Is there a workaround?
If I change the second statement to
let base = Array<Json>["foo"];
then it compiles.
Anything else?
No response
Wing Version
0.54.28
Node.js Version
20.9.0
Platform(s)
MacOS
Community Notes
Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.
The text was updated successfully, but these errors were encountered:
error: Expected type to be "Array<Json>", but got "Array<Json>" instead
--> main.w:5:27
|
5 | second: ["cool"].concat(base)
| ^^^^ Expected type to be "Array<Json>", but got "Array<Json>" instead
In principle this code should also compile if base is annotated as Array<str>.
Failed to compile.
error: Expected type to be "Json", but got "Json" instead
--> wing/main.w:8:10
|
8 | takeJson({ values: arr });
| ^^^^^^^^^^^^^^^
error: "MutArray<num>" is not a legal JSON value
--> wing/main.w:8:20
|
8 | takeJson({ values: arr });
| ^^^
The easiest fix is to convert the MutArray to a plain Array by calling .copy(), but the error message should be improved
I tried this:
This happened:
I expected this:
No error
Is there a workaround?
If I change the second statement to
then it compiles.
Anything else?
No response
Wing Version
0.54.28
Node.js Version
20.9.0
Platform(s)
MacOS
Community Notes
The text was updated successfully, but these errors were encountered: