Title: @Inject enum in constructor causes runtime error after building in JIT mode. · Issue #38513 · angular/angular · GitHub
Open Graph Title: @Inject enum in constructor causes runtime error after building in JIT mode. · Issue #38513 · angular/angular
X Title: @Inject enum in constructor causes runtime error after building in JIT mode. · Issue #38513 · angular/angular
Description: 🐞 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 ru...
Open Graph Description: 🐞 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 Usi...
X Description: 🐞 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 Usi...
Opengraph URL: https://github.com/angular/angular/issues/38513
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@Inject enum in constructor causes runtime error after building in JIT mode.","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\n\u003c!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->\r\n\u003c!-- ✍️edit: --> The issue is caused by package @angular/cli (not sure)\r\n\r\n\r\n### Is this a regression?\r\n\r\n\u003c!-- Did this behavior use to work in the previous version? -->\r\nYes, the previous version in which this bug was not present was: Angular 9\r\n\r\n\r\n### Description\r\nUsing @Inject enum in constructor causes runtime error after building in JIT mode.\r\n```\r\nexport const SomeInjectionToken = new InjectionToken\u003cAAA>('HostEnvironment');\r\n\r\nexport const enum AAA { S = 1, D = 3 };\r\n\r\n@Component({\r\n selector: 'app-root',\r\n templateUrl: './app.component.html',\r\n styleUrls: ['./app.component.css']\r\n})\r\nexport class AppComponent {\r\n constructor(\r\n @Optional() @Inject(SomeInjectionToken) p: AAA\r\n ) {\r\n console.log(p);\r\n }\r\n title = 'injectEnumBug';\r\n}\r\n```\r\nError: \r\n\r\n\r\n\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\n1. Clone repo https://github.com/VlasovSergey/-angular-injectEnumBugApp\r\n2. Run `ng serve` and open app page.\r\n\r\nor \r\n\r\n1. Set `aot: false` in angular json.\r\n2. Use InjectionToken with enum as I showed above.\r\n3. Run `ng serve` and open the app page. \r\n\r\n## 🔥 Exception or Error\r\n\u003cpre>\u003ccode>\r\nReferenceError: AAA is not defined\r\n at push../src/app/app.component.ts.AppComponent.ctorParameters (main.js:108)\r\n at ReflectionCapabilities._ownParameters (vendor.js:45378)\r\n at ReflectionCapabilities.parameters (vendor.js:45403)\r\n at reflectDependencies (vendor.js:45561)\r\n at directiveMetadata (vendor.js:60983)\r\n at Function.get (vendor.js:60886)\r\n at getComponentDef (vendor.js:36704)\r\n at verifyDeclarationsHaveDefinitions (vendor.js:60557)\r\n at Array.forEach (\u003canonymous>)\r\n at verifySemanticsOfNgModuleDef (vendor.js:60529)\r\n\u003c/code>\u003c/pre>\r\n\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n\u003cpre>\u003ccode>\r\nAngular CLI: 10.0.6\r\nNode: 10.15.2\r\nOS: win32 x64\r\n\r\nAngular: 10.0.10\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... platform-browser, platform-browser-dynamic, router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n-----------------------------------------------------------\r\n@angular-devkit/architect 0.1000.6\r\n@angular-devkit/build-angular 0.1000.6\r\n@angular-devkit/build-optimizer 0.1000.6\r\n@angular-devkit/build-webpack 0.1000.6\r\n@angular-devkit/core 10.0.6\r\n@angular-devkit/schematics 10.0.6\r\n@angular/cli 10.0.6\r\n@ngtools/webpack 10.0.6\r\n@schematics/angular 10.0.6\r\n@schematics/update 0.1000.6\r\nrxjs 6.5.5\r\ntypescript 3.9.7\r\nwebpack 4.43.0\r\n\r\n\u003c/code>\u003c/pre>","author":{"url":"https://github.com/fasergeyte","@type":"Person","name":"fasergeyte"},"datePublished":"2020-08-18T16:15:00Z","url":"https://github.com/angular/angular/issues/38513"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a5daf955-ca89-05a4-cf9e-c1a00c9a112c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD8A:2463BD:20863D6:2988365:6B016200 |
| html-safe-nonce | 69a6a9df0fa9b4aa71729a1d62dcd0dadae3662594ade793d430230898a374f8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDhBOjI0NjNCRDoyMDg2M0Q2OjI5ODgzNjU6NkIwMTYyMDAiLCJ2aXNpdG9yX2lkIjoiNzE4NDI4MTQ5ODIwNjQyOTY5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae4cc45c82b3f425849f31dfedd782cb63d21307759f50d56a0d24cec22739a8 |
| hovercard-subject-tag | issue:681166612 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/38513/issue_layout |
| twitter:image | https://opengraph.githubassets.com/491bcf60aaee0da80f53464625ce52751453056e702d01c28e7902917a42d21b/angular/angular/issues/38513 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/491bcf60aaee0da80f53464625ce52751453056e702d01c28e7902917a42d21b/angular/angular/issues/38513 |
| og:image:alt | 🐞 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 Usi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fasergeyte |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width