@@ -13,16 +13,16 @@ import {
13
13
} from './webpack-configs' ;
14
14
import * as path from 'path' ;
15
15
16
- export interface WebpackConfigOptions {
16
+ export interface WebpackConfigOptions < T extends BuildOptions = BuildOptions > {
17
17
projectRoot : string ;
18
- buildOptions : BuildOptions ;
18
+ buildOptions : T ;
19
19
appConfig : any ;
20
20
}
21
21
22
- export class NgCliWebpackConfig {
22
+ export class NgCliWebpackConfig < T extends BuildOptions = BuildOptions > {
23
23
public config : any ;
24
- public wco : WebpackConfigOptions ;
25
- constructor ( buildOptions : BuildOptions , appConfig : any ) {
24
+ public wco : WebpackConfigOptions < T > ;
25
+ constructor ( buildOptions : T , appConfig : any ) {
26
26
27
27
this . validateBuildOptions ( buildOptions ) ;
28
28
@@ -58,7 +58,7 @@ export class NgCliWebpackConfig {
58
58
return this . config ;
59
59
}
60
60
61
- public getTargetConfig ( webpackConfigOptions : WebpackConfigOptions ) : any {
61
+ public getTargetConfig ( webpackConfigOptions : WebpackConfigOptions < T > ) : any {
62
62
switch ( webpackConfigOptions . buildOptions . target ) {
63
63
case 'development' :
64
64
return getDevConfig ( webpackConfigOptions ) ;
@@ -81,8 +81,8 @@ export class NgCliWebpackConfig {
81
81
}
82
82
83
83
// Fill in defaults for build targets
84
- public addTargetDefaults ( buildOptions : BuildOptions ) : BuildOptions {
85
- const targetDefaults : { [ target : string ] : BuildOptions } = {
84
+ public addTargetDefaults ( buildOptions : T ) : T {
85
+ const targetDefaults : { [ target : string ] : Partial < BuildOptions > } = {
86
86
development : {
87
87
environment : 'dev' ,
88
88
outputHashing : 'media' ,
@@ -105,8 +105,8 @@ export class NgCliWebpackConfig {
105
105
}
106
106
107
107
// Fill in defaults from .angular-cli.json
108
- public mergeConfigs ( buildOptions : BuildOptions , appConfig : any , projectRoot : string ) {
109
- const mergeableOptions = {
108
+ public mergeConfigs ( buildOptions : T , appConfig : any , projectRoot : string ) : T {
109
+ const mergeableOptions : Partial < BuildOptions > = {
110
110
outputPath : path . resolve ( projectRoot , appConfig . outDir ) ,
111
111
deployUrl : appConfig . deployUrl ,
112
112
baseHref : appConfig . baseHref
0 commit comments