Skip to content

Commit 4f7dcdc

Browse files
fix(schematics): components should inject the store without generic (#2512)
1 parent 831e1e4 commit 4f7dcdc

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

modules/schematics/src/container/files/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { provideMockStore, MockStore } from '@ngrx/store/testing';
66
describe('<%= classify(name) %>Component', () => {
77
let component: <%= classify(name) %>Component;
88
let fixture: ComponentFixture<<%= classify(name) %>Component>;
9-
let store: MockStore<any>;
9+
let store: MockStore;
1010

1111
beforeEach(async() => {
1212
TestBed.configureTestingModule({

modules/schematics/src/container/index.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ describe('Container Schematic', () => {
103103
const content = tree.readContent(
104104
`${projectPath}/src/app/foo/foo.component.ts`
105105
);
106-
expect(content).toMatch(
107-
/constructor\(private store\: Store\<fromStore\.State\>\) { }\n\n/
108-
);
106+
107+
expect(content).toMatch(/constructor\(private store\: Store\) { }\n\n/);
109108
});
110109

111110
it('should update the component spec', async () => {

modules/schematics/src/container/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,9 @@ function addStateToComponent(options: Partial<ContainerOptions>) {
9090
);
9191
const cmpCtr = componentConstructor as ts.ConstructorDeclaration;
9292
const { pos } = cmpCtr;
93-
const stateType = options.state
94-
? `fromStore.${options.stateInterface}`
95-
: 'any';
9693
const constructorText = cmpCtr.getText();
9794
const [start, end] = constructorText.split('()');
98-
const storeText = `private store: Store<${stateType}>`;
99-
const storeConstructor = [start, `(${storeText})`, end].join('');
95+
const storeConstructor = [start, `(private store: Store)`, end].join('');
10096
const constructorUpdate = new ReplaceChange(
10197
componentPath,
10298
pos,

modules/schematics/src/container/integration-files/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Store, StoreModule } from '@ngrx/store';
66
describe('<%= classify(name) %>Component', () => {
77
let component: <%= classify(name) %>Component;
88
let fixture: ComponentFixture<<%= classify(name) %>Component>;
9-
let store: Store<any>;
9+
let store: Store;
1010

1111
beforeEach(async() => {
1212
TestBed.configureTestingModule({

0 commit comments

Comments
 (0)