Skip to content

Commit f0daa8c

Browse files
committed
refactor(@angular-devkit/build-angular): remove unneeded JsonObject type casting
The use of the `@angular-devkit/core` `JsonObject` type is no longer needed to satisfy the type requirements of `@angular-devkit/architect` package builder creation functions.
1 parent e529fb8 commit f0daa8c

File tree

6 files changed

+28
-32
lines changed

6 files changed

+28
-32
lines changed

goldens/public-api/angular_devkit/build_angular/src/index.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { BuildResult } from '@angular-devkit/build-webpack';
1010
import { ConfigOptions } from 'karma';
1111
import { Configuration } from 'webpack';
1212
import { DevServerBuildOutput } from '@angular-devkit/build-webpack';
13-
import { json } from '@angular-devkit/core';
14-
import { JsonObject } from '@angular-devkit/core';
1513
import { Observable } from 'rxjs';
1614
import webpack from 'webpack';
1715
import { WebpackLoggingCallback } from '@angular-devkit/build-webpack';
@@ -74,7 +72,7 @@ export interface BrowserBuilderOptions {
7472
}
7573

7674
// @public
77-
export type BrowserBuilderOutput = json.JsonObject & BuilderOutput & {
75+
export type BrowserBuilderOutput = BuilderOutput & {
7876
baseOutputPath: string;
7977
outputPaths: string[];
8078
outputPath: string;
@@ -104,7 +102,7 @@ export enum CrossOrigin {
104102
}
105103

106104
// @public (undocumented)
107-
export type DevServerBuilderOptions = Schema & json.JsonObject;
105+
export type DevServerBuilderOptions = Schema;
108106

109107
// @public
110108
export type DevServerBuilderOutput = DevServerBuildOutput & {
@@ -151,7 +149,7 @@ export function executeServerBuilder(options: ServerBuilderOptions, context: Bui
151149
export type ExecutionTransformer<T> = (input: T) => T | Promise<T>;
152150

153151
// @public (undocumented)
154-
export type ExtractI18nBuilderOptions = Schema_2 & JsonObject;
152+
export type ExtractI18nBuilderOptions = Schema_2;
155153

156154
// @public (undocumented)
157155
export interface FileReplacement {
@@ -270,7 +268,7 @@ export interface ServerBuilderOptions {
270268
}
271269

272270
// @public
273-
export type ServerBuilderOutput = json.JsonObject & BuilderOutput & {
271+
export type ServerBuilderOutput = BuilderOutput & {
274272
baseOutputPath: string;
275273
outputPaths: string[];
276274
outputPath: string;

packages/angular_devkit/build_angular/src/builders/browser/index.ts

+10-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
1010
import { EmittedFiles, WebpackLoggingCallback, runWebpack } from '@angular-devkit/build-webpack';
11-
import { json, logging, normalize } from '@angular-devkit/core';
11+
import { logging, normalize } from '@angular-devkit/core';
1212
import * as fs from 'fs';
1313
import * as path from 'path';
1414
import { Observable, from } from 'rxjs';
@@ -64,15 +64,14 @@ import { Schema as BrowserBuilderSchema } from './schema';
6464
/**
6565
* @experimental Direct usage of this type is considered experimental.
6666
*/
67-
export type BrowserBuilderOutput = json.JsonObject &
68-
BuilderOutput & {
69-
baseOutputPath: string;
70-
outputPaths: string[];
71-
/**
72-
* @deprecated in version 9. Use 'outputPaths' instead.
73-
*/
74-
outputPath: string;
75-
};
67+
export type BrowserBuilderOutput = BuilderOutput & {
68+
baseOutputPath: string;
69+
outputPaths: string[];
70+
/**
71+
* @deprecated in version 9. Use 'outputPaths' instead.
72+
*/
73+
outputPath: string;
74+
};
7675

7776
/**
7877
* Maximum time in milliseconds for single build/rebuild
@@ -436,4 +435,4 @@ function checkInternetExplorerSupport(projectRoot: string, logger: logging.Logge
436435
}
437436
}
438437

439-
export default createBuilder<json.JsonObject & BrowserBuilderSchema>(buildWebpackBrowser);
438+
export default createBuilder<BrowserBuilderSchema>(buildWebpackBrowser);

packages/angular_devkit/build_angular/src/builders/dev-server/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { createWebpackLoggingCallback } from '../../webpack/utils/stats';
4747
import { Schema as BrowserBuilderSchema, OutputHashing } from '../browser/schema';
4848
import { Schema } from './schema';
4949

50-
export type DevServerBuilderOptions = Schema & json.JsonObject;
50+
export type DevServerBuilderOptions = Schema;
5151

5252
/**
5353
* @experimental Direct usage of this type is considered experimental.
@@ -82,7 +82,7 @@ export function serveWebpackBrowser(
8282
const browserTarget = targetFromTargetString(options.browserTarget);
8383

8484
async function setup(): Promise<{
85-
browserOptions: json.JsonObject & BrowserBuilderSchema;
85+
browserOptions: BrowserBuilderSchema;
8686
webpackConfig: webpack.Configuration;
8787
projectRoot: string;
8888
}> {

packages/angular_devkit/build_angular/src/builders/extract-i18n/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { createWebpackLoggingCallback } from '../../webpack/utils/stats';
2525
import { Schema as BrowserBuilderOptions, OutputHashing } from '../browser/schema';
2626
import { Format, Schema } from './schema';
2727

28-
export type ExtractI18nBuilderOptions = Schema & JsonObject;
28+
export type ExtractI18nBuilderOptions = Schema;
2929

3030
function getI18nOutfile(format: string | undefined) {
3131
switch (format) {

packages/angular_devkit/build_angular/src/builders/protractor/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
createBuilder,
1313
targetFromTargetString,
1414
} from '@angular-devkit/architect';
15-
import { tags } from '@angular-devkit/core';
15+
import { json, tags } from '@angular-devkit/core';
1616
import { resolve } from 'path';
1717
import * as url from 'url';
1818
import { runModuleAsObservableFork } from '../../utils';
@@ -114,7 +114,7 @@ export async function execute(
114114
const overrides = {
115115
watch: false,
116116
liveReload: false,
117-
} as DevServerBuilderOptions;
117+
} as DevServerBuilderOptions & json.JsonObject;
118118

119119
if (options.host !== undefined) {
120120
overrides.host = options.host;

packages/angular_devkit/build_angular/src/builders/server/index.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
1010
import { runWebpack } from '@angular-devkit/build-webpack';
11-
import { json, tags } from '@angular-devkit/core';
11+
import { tags } from '@angular-devkit/core';
1212
import * as path from 'path';
1313
import { Observable, from } from 'rxjs';
1414
import { concatMap, map } from 'rxjs/operators';
@@ -29,15 +29,14 @@ import { Schema as ServerBuilderOptions } from './schema';
2929
/**
3030
* @experimental Direct usage of this type is considered experimental.
3131
*/
32-
export type ServerBuilderOutput = json.JsonObject &
33-
BuilderOutput & {
34-
baseOutputPath: string;
35-
outputPaths: string[];
36-
/**
37-
* @deprecated in version 9. Use 'outputPaths' instead.
38-
*/
39-
outputPath: string;
40-
};
32+
export type ServerBuilderOutput = BuilderOutput & {
33+
baseOutputPath: string;
34+
outputPaths: string[];
35+
/**
36+
* @deprecated in version 9. Use 'outputPaths' instead.
37+
*/
38+
outputPath: string;
39+
};
4140

4241
export { ServerBuilderOptions };
4342

0 commit comments

Comments
 (0)