-
Notifications
You must be signed in to change notification settings - Fork 26.6k
fix(core): allow readonly arrays in NgModule imports and exports #48106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): allow readonly arrays in NgModule imports and exports #48106
Conversation
Note to a reviewer: I'm not sure if we can make this change in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
reviewed-for: fw-core, public-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: public-api
c985860
to
22e317c
Compare
@@ -136,7 +136,7 @@ export interface NgModule { | |||
* ``` | |||
* | |||
*/ | |||
imports?: Array<Type<any>|ModuleWithProviders<{}>|any[]>; | |||
imports?: Array<Type<any>|ModuleWithProviders<{}>|ReadonlyArray<any>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be:
imports?: Array<Type<any>|ModuleWithProviders<{}>|ReadonlyArray<any>>; | |
imports?: Array<Type<any>|ModuleWithProviders<{}>|ReadonlyArray<Type<any>>>; |
in which case I think we can just do:
imports?: Array<Type<any>|ModuleWithProviders<{}>|ReadonlyArray<any>>; | |
imports?: ReadonlyArray<Type<any>|ModuleWithProviders<{}>; |
as all Array
s are implicitly ReadonlyArray
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can Type<any>
represent an array of types? Previously, it was valid to import an array directly, like this:
const myArr = [/*...*/];
import: [myArr]
IMO keeping the type as-is can be more descriptive about what the import
accepts.
@pkozlowski-opensource are you planning to finish this PR anytime in near future? |
Any update on this? |
Based on the following rejections and @pkozlowski-opensource lack of response, it seems the PR will be just forgotten until it's closed due to its age. |
Following this since it is still a problem on production code. |
336e217
to
261ae4c
Compare
NgModule should support readonly arrays in `@NgModule.imports` and `@NgModule.exports`. Fixes angular#48089
261ae4c
to
bf44b7d
Compare
@pkozlowski-opensource @alxhub |
@pkozlowski-opensource could you please provide a very short info if this was solved elsewhere or wont be solved or ? thank you! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
NgModule should support readonly arrays in
@NgModule.imports
and@NgModule.exports
.Partly fixes #48089 (#48091 is also needed)