@@ -13,16 +13,16 @@ import {
1313} from './webpack-configs' ;
1414import * as path from 'path' ;
1515
16- export interface WebpackConfigOptions {
16+ export interface WebpackConfigOptions < T extends BuildOptions = BuildOptions > {
1717 projectRoot : string ;
18- buildOptions : BuildOptions ;
18+ buildOptions : T ;
1919 appConfig : any ;
2020}
2121
22- export class NgCliWebpackConfig {
22+ export class NgCliWebpackConfig < T extends BuildOptions = BuildOptions > {
2323 public config : any ;
24- public wco : WebpackConfigOptions ;
25- constructor ( buildOptions : BuildOptions , appConfig : any ) {
24+ public wco : WebpackConfigOptions < T > ;
25+ constructor ( buildOptions : T , appConfig : any ) {
2626
2727 this . validateBuildOptions ( buildOptions ) ;
2828
@@ -58,7 +58,7 @@ export class NgCliWebpackConfig {
5858 return this . config ;
5959 }
6060
61- public getTargetConfig ( webpackConfigOptions : WebpackConfigOptions ) : any {
61+ public getTargetConfig ( webpackConfigOptions : WebpackConfigOptions < T > ) : any {
6262 switch ( webpackConfigOptions . buildOptions . target ) {
6363 case 'development' :
6464 return getDevConfig ( webpackConfigOptions ) ;
@@ -81,8 +81,8 @@ export class NgCliWebpackConfig {
8181 }
8282
8383 // 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 > } = {
8686 development : {
8787 environment : 'dev' ,
8888 outputHashing : 'media' ,
@@ -105,8 +105,8 @@ export class NgCliWebpackConfig {
105105 }
106106
107107 // 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 > = {
110110 outputPath : path . resolve ( projectRoot , appConfig . outDir ) ,
111111 deployUrl : appConfig . deployUrl ,
112112 baseHref : appConfig . baseHref
0 commit comments