-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
area: @schematics/angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix
Milestone
Description
🐞 Bug report
Command (mark with an x
)
- [x] generate
Is this a regression?
Probably, found it on version 8.3.5
Description
The "declaration" key in @NgModule duplicating when generating stuff.
🔬 Minimal Reproduction
- Put a quotes or a double-quotes on the "declaration" key at any @NgModule. Or set "object-literal-key-quotes" on tslint to [true, "always"]. Originally, it would look like this:
@NgModule({
declarations: [Component1, Component2],
imports: [
CommonModule,
OtherModule
]
})
- Run ng lint --fix (if you did the tslint). It should now look like this:
@NgModule({
"declarations": [Component1, Component2], // ---> added quotes on the "declaration"
"imports": [
CommonModule,
OtherModule
]
})
- Generate a component where it would import on the said module. It either generates another "declaration" key with or without quotes (depending on your schematics whether you run lint after generating). It would now look like this:
@NgModule({
"declarations": [Component1, Component2],
"imports": [
CommonModule,
OtherModule
]
"declarations": [Component3] // ---> It would generate this with or without quotes instead of merging it with the existing one
})
🔥 Exception or Error
Running ng serve now throws the error
error TS2300: Duplicate identifier 'declarations'.
Other Notes
Not big of an issue, but it kills some of the tasks that should be automated when you have a custom tslint settings at the same time.
Metadata
Metadata
Assignees
Labels
area: @schematics/angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix