Skip to content

Commit 2d0943d

Browse files
dgp1130angular-robot[bot]
authored andcommitted
refactor: loosen experimental warnings types
As is, the `browser` and `browser-esbuild` schemas needed to be identical to check for unsupported properties. This loosens it slightly by casting the `browser-esbuild` schema into the `browser` schema and looking for invalid properties. This makes the module more flexible as the `browser-esbuild` schema evolves _and_ more closely aligns with the actual mistake of users who incorrectly think of `browser-esbuild` as supporting all the options of `browser`, which it does not yet do so.
1 parent 866263b commit 2d0943d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/experimental-warnings.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import { BuilderContext } from '@angular-devkit/architect';
1010
import { Schema as BrowserBuilderOptions } from '../browser/schema';
11+
import { Schema as BrowserEsbuildOptions } from './schema';
1112

1213
const UNSUPPORTED_OPTIONS: Array<keyof BrowserBuilderOptions> = [
1314
'budgets',
@@ -30,7 +31,7 @@ const UNSUPPORTED_OPTIONS: Array<keyof BrowserBuilderOptions> = [
3031
'webWorkerTsConfig',
3132
];
3233

33-
export function logExperimentalWarnings(options: BrowserBuilderOptions, context: BuilderContext) {
34+
export function logExperimentalWarnings(options: BrowserEsbuildOptions, context: BuilderContext) {
3435
// Warn about experimental status of this builder
3536
context.logger.warn(
3637
`The esbuild browser application builder ('browser-esbuild') is currently experimental.`,
@@ -39,7 +40,7 @@ export function logExperimentalWarnings(options: BrowserBuilderOptions, context:
3940
// Validate supported options
4041
// Currently only a subset of the Webpack-based browser builder options are supported.
4142
for (const unsupportedOption of UNSUPPORTED_OPTIONS) {
42-
const value = options[unsupportedOption];
43+
const value = (options as unknown as BrowserBuilderOptions)[unsupportedOption];
4344

4445
if (value === undefined || value === false) {
4546
continue;

0 commit comments

Comments
 (0)