Which @angular/* package(s) are relevant/related to the feature request?
core
Description
Hello,
I wish TestModuleMetadata were typed a little more. I have seen something along the lines of:
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
providers: [{provide: MyService, usevalue: myMock}]
}).compileComponents();
useValue isn't written correctly, there is no error in the static code analysis, because the actual type is just any[].
Proposed solution
Maybe we can change it to something like:
export interface ProviderInterface {
provide: any;
useValue: any;
multi?: boolean;
}
... TestModuleMetadata
imports?: Array<Type<any>|ModuleWithProviders<unknown>|any[]>;
providers?: Array<ProviderInterface | TypeProvider | EnvironmentProviders>;
componentProviders?: Array<ProviderInterface | TypeProvider | EnvironmentProviders>;
This would still allow people to pass any mock for providers they want, but we would help them get the structure for the provider correctly.
Alternatives considered
None
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
Hello,
I wish
TestModuleMetadatawere typed a little more. I have seen something along the lines of:useValueisn't written correctly, there is no error in the static code analysis, because the actual type is justany[].Proposed solution
Maybe we can change it to something like:
This would still allow people to pass any mock for providers they want, but we would help them get the structure for the provider correctly.
Alternatives considered
None