microsoft / typespec

https://typespec.io/
MIT License
3.88k stars 174 forks source link

[Bug]: `Array<Element>` is not entirely equivalent to `Element[]` as the document says #3598

Open ArcturusZhang opened 3 weeks ago

ArcturusZhang commented 3 weeks ago

Describe the bug

I could write

model Foo extends Array<int32> {}

but the following

model Foo extends int32[] {}

gives me compilation error.

The doc here says they are equivalent.

Reproduction

Just wrote the above two typespec snippets in the playground: https://typespec.io/playground?c=bW9kZWwgQSBleHRlbmRzIEFycmF5PGludDMyPiB7fQ0KDQrHI8okxR5bXc0fQiBp2z1CxR%2FKOA%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D

Checklist

markcowl commented 2 weeks ago

@bterlson Please find the duplicate issue for this

ArcturusZhang commented 2 weeks ago

@bterlson Please find the duplicate issue for this

so when I search the word Array I did not find a duplicate for this in the open issues. Would it be a closed issue which indicates this is by design as well?