Skip to content

[Bug]: Unable to make const declaration of union variant #10320

@ericsuh

Description

@ericsuh

Describe the bug

A const declaration whose annotated type is a variant of a union cannot be assigned to.

This arises in the context of creating const declarations for discriminated unions where the discriminator field is a union.

Reproduction

https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=bmFtZXNwYWNlIEV4YW1wbGU7DQoNCnVuaW9uIFNwZWNpZXMgew0KICAgIGNhdDogImNhdCINCn3EJi8vIEVycm9yOiBUeXBlICfFHCcgaXMgbm90IGFzc2lnbmFibGUgdG8gdMsixC7EXCh1bsolKQ0KY29uc3QgZeYAiFZhbHVlOugAhC5jYXQgPcwOOw%3D%3D&options=%7B%7D&vs=%7B%7D

Checklist

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions