Skip to content

Commit 7e57106

Browse files
devversionthePunderWoman
authored andcommitted
refactor(compiler): avoid duplication between FactoryTarget type (angular#61472)
Avoids duplication of the `FactoryTarget` enums. This is necessary now because we are exposing the previously deeply-imported JIT facade now via the exports; and the typing integration tests surface a type conflict due to the different duplicated enums. PR Close angular#61472
1 parent 082cc55 commit 7e57106

File tree

6 files changed

+8
-20
lines changed

6 files changed

+8
-20
lines changed

packages/compiler/src/compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ export {
191191
} from './render3/r3_class_metadata_compiler';
192192
export {
193193
compileFactoryFunction,
194-
FactoryTarget,
195194
R3DependencyMetadata,
196195
R3FactoryMetadata,
197196
} from './render3/r3_factory';
@@ -252,6 +251,7 @@ export {Version, escapeRegExp} from './util';
252251
export * from './version';
253252
export {outputAst};
254253
export {CompilerFacadeImpl} from './jit_compiler_facade';
254+
export {FactoryTarget} from './compiler_facade_interface';
255255

256256
// This file only reexports content of the `src` folder. Keep it that way.
257257

packages/compiler/src/injectable_compiler_2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9+
import {FactoryTarget} from './compiler_facade_interface';
910
import * as o from './output/output_ast';
1011
import {
1112
compileFactoryFunction,
12-
FactoryTarget,
1313
R3DependencyMetadata,
1414
R3FactoryDelegateType,
1515
R3FactoryMetadata,

packages/compiler/src/jit_compiler_facade.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
CompilerFacade,
1111
CoreEnvironment,
1212
ExportedCompilerFacade,
13+
FactoryTarget,
1314
LegacyInputPartialMapping,
1415
OpaqueValue,
1516
R3ComponentMetadataFacade,
@@ -57,7 +58,7 @@ import {
5758
import {JitEvaluator} from './output/output_jit';
5859
import {ParseError, ParseSourceSpan, r3JitTypeSourceSpan} from './parse_util';
5960
import {DeferredBlock} from './render3/r3_ast';
60-
import {compileFactoryFunction, FactoryTarget, R3DependencyMetadata} from './render3/r3_factory';
61+
import {compileFactoryFunction, R3DependencyMetadata} from './render3/r3_factory';
6162
import {compileInjector, R3InjectorMetadata} from './render3/r3_injector_compiler';
6263
import {R3JitReflector} from './render3/r3_jit';
6364
import {

packages/compiler/src/render3/partial/api.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.dev/license
77
*/
8+
import {FactoryTarget} from '../../compiler_facade_interface';
89
import {ChangeDetectionStrategy, ViewEncapsulation} from '../../core';
910
import * as o from '../../output/output_ast';
1011

@@ -443,14 +444,6 @@ export interface R3DeclareFactoryMetadata extends R3PartialDeclaration {
443444
target: FactoryTarget;
444445
}
445446

446-
export enum FactoryTarget {
447-
Directive = 0,
448-
Component = 1,
449-
Injectable = 2,
450-
Pipe = 3,
451-
NgModule = 4,
452-
}
453-
454447
/**
455448
* Describes the shape of the object that the `ɵɵngDeclareInjectable()` function accepts.
456449
*

packages/compiler/src/render3/partial/factory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.dev/license
77
*/
8+
import {FactoryTarget} from '../../compiler_facade_interface';
89
import * as o from '../../output/output_ast';
9-
import {createFactoryType, FactoryTarget, R3FactoryMetadata} from '../r3_factory';
10+
import {createFactoryType, R3FactoryMetadata} from '../r3_factory';
1011
import {Identifiers as R3} from '../r3_identifiers';
1112
import {R3CompiledExpression} from '../util';
1213
import {DefinitionMap} from '../view/util';

packages/compiler/src/render3/r3_factory.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.dev/license
77
*/
8+
import {FactoryTarget} from '../compiler_facade_interface';
89
import {InjectFlags} from '../core';
910
import * as o from '../output/output_ast';
1011
import {Identifiers as R3} from '../render3/r3_identifiers';
@@ -64,14 +65,6 @@ export type R3FactoryMetadata =
6465
| R3DelegatedFnOrClassMetadata
6566
| R3ExpressionFactoryMetadata;
6667

67-
export enum FactoryTarget {
68-
Directive = 0,
69-
Component = 1,
70-
Injectable = 2,
71-
Pipe = 3,
72-
NgModule = 4,
73-
}
74-
7568
export interface R3DependencyMetadata {
7669
/**
7770
* An expression representing the token or value to be injected.

0 commit comments

Comments
 (0)