@@ -14,16 +14,16 @@ import {
1414import * as path from 'path' ;
1515import { AngularCompilerPlugin } from '@ngtools/webpack' ;
1616
17- export interface WebpackConfigOptions {
17+ export interface WebpackConfigOptions < T extends BuildOptions = BuildOptions > {
1818 projectRoot : string ;
19- buildOptions : BuildOptions ;
19+ buildOptions : T ;
2020 appConfig : any ;
2121}
2222
23- export class NgCliWebpackConfig {
23+ export class NgCliWebpackConfig < T extends BuildOptions = BuildOptions > {
2424 public config : any ;
25- public wco : WebpackConfigOptions ;
26- constructor ( buildOptions : BuildOptions , appConfig : any ) {
25+ public wco : WebpackConfigOptions < T > ;
26+ constructor ( buildOptions : T , appConfig : any ) {
2727
2828 this . validateBuildOptions ( buildOptions ) ;
2929
@@ -59,7 +59,7 @@ export class NgCliWebpackConfig {
5959 return this . config ;
6060 }
6161
62- public getTargetConfig ( webpackConfigOptions : WebpackConfigOptions ) : any {
62+ public getTargetConfig ( webpackConfigOptions : WebpackConfigOptions < T > ) : any {
6363 switch ( webpackConfigOptions . buildOptions . target ) {
6464 case 'development' :
6565 return getDevConfig ( webpackConfigOptions ) ;
@@ -86,8 +86,8 @@ export class NgCliWebpackConfig {
8686 }
8787
8888 // Fill in defaults for build targets
89- public addTargetDefaults ( buildOptions : BuildOptions ) : BuildOptions {
90- const targetDefaults : { [ target : string ] : BuildOptions } = {
89+ public addTargetDefaults ( buildOptions : T ) : T {
90+ const targetDefaults : { [ target : string ] : Partial < BuildOptions > } = {
9191 development : {
9292 environment : 'dev' ,
9393 outputHashing : 'media' ,
@@ -110,8 +110,8 @@ export class NgCliWebpackConfig {
110110 }
111111
112112 // Fill in defaults from .angular-cli.json
113- public mergeConfigs ( buildOptions : BuildOptions , appConfig : any , projectRoot : string ) {
114- const mergeableOptions = {
113+ public mergeConfigs ( buildOptions : T , appConfig : any , projectRoot : string ) : T {
114+ const mergeableOptions : Partial < BuildOptions > = {
115115 outputPath : path . resolve ( projectRoot , appConfig . outDir ) ,
116116 deployUrl : appConfig . deployUrl ,
117117 baseHref : appConfig . baseHref
0 commit comments