Wing lets you initialize many kinds of values by defining their initial value on the right-hand side of an =, and their type on the left hand side of the =:
struct Foo {
name: str?;
}
let x: Foo = {};
I expect this to also work for MutArray, Set, and MutSet values:
let x: MutArray<str> = [];
let y: Set<str> = [];
let z: MutSet<str> = [];
This happened:
error: Expected type to be "MutArray<str>", but got "Array<unknown>" instead
--> wing/main.w:1:24
|
1 | let x: MutArray<str> = [];
| ^^
I expected this:
No error
Is there a workaround?
let x = MutArray<str>[];
Anything else?
No response
Wing Version
0.84.7
Node.js Version
20.12.2
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.
I tried this:
Wing lets you initialize many kinds of values by defining their initial value on the right-hand side of an
=
, and their type on the left hand side of the=
:I expect this to also work for
MutArray
,Set
, andMutSet
values:This happened:
I expected this:
No error
Is there a workaround?
Anything else?
No response
Wing Version
0.84.7
Node.js Version
20.12.2
Platform(s)
MacOS
Community Notes