🐞 bug report
Affected Package
The issue is caused by package @angular/cli (not sure)
Is this a regression?
Yes, the previous version in which this bug was not present was: Angular 9
Description
Using @Inject enum in constructor causes runtime error after building in JIT mode.
export const SomeInjectionToken = new InjectionToken<AAA>('HostEnvironment');
export const enum AAA { S = 1, D = 3 };
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(
@Optional() @Inject(SomeInjectionToken) p: AAA
) {
console.log(p);
}
title = 'injectEnumBug';
}
Error:


🔬 Minimal Reproduction
- Clone repo https://github.com/VlasovSergey/-angular-injectEnumBugApp
- Run
ng serve and open app page.
or
- Set
aot: false in angular json.
- Use InjectionToken with enum as I showed above.
- Run
ng serve and open the app page.
🔥 Exception or Error
ReferenceError: AAA is not defined
at push../src/app/app.component.ts.AppComponent.ctorParameters (main.js:108)
at ReflectionCapabilities._ownParameters (vendor.js:45378)
at ReflectionCapabilities.parameters (vendor.js:45403)
at reflectDependencies (vendor.js:45561)
at directiveMetadata (vendor.js:60983)
at Function.get (vendor.js:60886)
at getComponentDef (vendor.js:36704)
at verifyDeclarationsHaveDefinitions (vendor.js:60557)
at Array.forEach ()
at verifySemanticsOfNgModuleDef (vendor.js:60529)
🌍 Your Environment
Angular Version:
Angular CLI: 10.0.6
Node: 10.15.2
OS: win32 x64
Angular: 10.0.10
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1000.6
@angular-devkit/build-angular 0.1000.6
@angular-devkit/build-optimizer 0.1000.6
@angular-devkit/build-webpack 0.1000.6
@angular-devkit/core 10.0.6
@angular-devkit/schematics 10.0.6
@angular/cli 10.0.6
@ngtools/webpack 10.0.6
@schematics/angular 10.0.6
@schematics/update 0.1000.6
rxjs 6.5.5
typescript 3.9.7
webpack 4.43.0
🐞 bug report
Affected Package
The issue is caused by package @angular/cli (not sure)Is this a regression?
Yes, the previous version in which this bug was not present was: Angular 9
Description
Using @Inject enum in constructor causes runtime error after building in JIT mode.
Error:


🔬 Minimal Reproduction
ng serveand open app page.or
aot: falsein angular json.ng serveand open the app page.🔥 Exception or Error
🌍 Your Environment
Angular Version: