refactor(core): make generic mandatory for ModuleWithProviders (#36892)
In v9, we deprecated the use of ModuleWithProviders without a generic. In v10, we will be requiring the generic when using ModuleWithProviders. You can read more about the reasoning behind this change in the migration guide: http://v9.angular.io/guide/migration-module-with-providers PR Close #36892
This commit is contained in:
parent
420b9be1c1
commit
20cc3ab37e
|
@ -23,7 +23,7 @@ export class GreetingModule {
|
|||
// #enddocregion ctor
|
||||
|
||||
// #docregion for-root
|
||||
static forRoot(config: UserServiceConfig): ModuleWithProviders {
|
||||
static forRoot(config: UserServiceConfig): ModuleWithProviders<GreetingModule> {
|
||||
return {
|
||||
ngModule: GreetingModule,
|
||||
providers: [
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"types": []
|
||||
"types": [],
|
||||
// TODO(FW-2145): turn lib checks back on after fixing in-memory-api and investigating impact of ModuleWithProviders
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts",
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
]
|
||||
],
|
||||
// TODO(FW-2145): turn lib checks back on after fixing in-memory-api and investigating impact of ModuleWithProviders
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false,
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
"suppressImplicitAnyIndexErrors": true,
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
]
|
||||
],
|
||||
// TODO(FW-2145): turn lib checks back on after fixing in-memory-api and investigating impact of ModuleWithProviders
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"../../../content/examples/*/e2e-spec.ts"
|
||||
|
|
|
@ -559,7 +559,7 @@ export declare class ModuleWithComponentFactories<T> {
|
|||
constructor(ngModuleFactory: NgModuleFactory<T>, componentFactories: ComponentFactory<any>[]);
|
||||
}
|
||||
|
||||
export declare interface ModuleWithProviders<T = any /** TODO(alxhub): remove default when callers pass explicit type param */> {
|
||||
export declare interface ModuleWithProviders<T> {
|
||||
ngModule: Type<T>;
|
||||
providers?: Provider[];
|
||||
}
|
||||
|
|
|
@ -82,16 +82,14 @@ export interface NgModuleDef<T> {
|
|||
/**
|
||||
* A wrapper around an NgModule that associates it with the providers.
|
||||
*
|
||||
* @param T the module type. In Ivy applications, this must be explicitly
|
||||
* provided.
|
||||
* @param T the module type.
|
||||
*
|
||||
* Note that using ModuleWithProviders without a generic type is deprecated.
|
||||
* The generic will become required in a future version of Angular.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ModuleWithProviders<
|
||||
T = any /** TODO(alxhub): remove default when callers pass explicit type param */> {
|
||||
export interface ModuleWithProviders<T> {
|
||||
ngModule: Type<T>;
|
||||
providers?: Provider[];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue