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
For the same reason we disallow structs except at the top-level of a file (see #5135). Interfaces only define contracts (they don't contain any source code) so there aren't strong use cases to support defining interfaces within if branches or as a result of code execution etc.
Got it, after reading Mark's comment I see how they're related - good callout.
(2 cents) Even if we support interface definitions existing inside classes in our type system (for backwards compatibility with existing JSII libraries, like the issue above shows), I think it might still be reasonable to prevent the creation of new interfaces in this way within Wing code.
Use Case
For the same reason we disallow structs except at the top-level of a file (see #5135). Interfaces only define contracts (they don't contain any source code) so there aren't strong use cases to support defining interfaces within if branches or as a result of code execution etc.
Proposed Solution
No response
Implementation Notes
No response
Component
Compiler
Community Notes
The text was updated successfully, but these errors were encountered: